SimApi Physics

From SIMboxWiki
Jump to navigation Jump to search

Class SimApi_Physics

Description

Provides functionality in the area of the relationship between the simulation and the physical engine.

Overview

SimiGon has developed infrastructure that intergrates with the NVidia PhysX physics engine. Several objects in the SIMbox base content use this mechanism and are simulated in the physics engine. When one of these objects is loaded, the simulation creates a single physical scene that contains the physical world. The physical simulation runs in parallel with the SIMbox simulation. Use the physics SDK to access the current physical scene, and the physical objects ("actors"), allowing you to get data from the different objects and to change their physical properties. Work with the physical objects and the physical scene using the PhysX physicsengine SDK. The PhysX SDK headers are supplies in the Physics SDK install. Access the physics SDK using the namespace SimApi::Physics. The SDK doesn't wrap the PhysX physics engine SDK. It offers functionality in the area of the relationship between the simulation objects and the physical engine actors. The simulation wraps the physX scene in a singleton class, assuring that only one physical scene is created. Every actor in the PhysX scene holds user-data with the entity name and the ID that it is connected to in the Simbox simulation. Based on the xml file that defines its physical properties, each simulation object can have one or more PhysX scene actors (for example, a Hummer will have the body + 4 Wheels - 5 actors). 

Remarks

Requires that you include sdk.Physics.h
Requires that you define NOMINMAX in the StdAfx.h of the using module, since the PhysX engine implements the min and max functions.

Public Class Members

Name Description
Icon attributes.png  GetActorFromEntity Overloaded. Additional information is available.
Icon attributes.png  GetActorEntityNameAndId Overloaded. Additional information is available.
Icon attributes.png  GetPhysicsScene Returns a pointer to the current physical scene. If none exists, creates one.
Icon attributes.png  IsSceneNull Checks if no physical scene was created in the simulation.
Icon attributes.png  GetPhysicsSDK Returns a pointer the PhysX SDK
Icon attributes.png  ReleasePhysicsScene Releases the physical scene
Icon attributes.png  AddContactReport Registers a contact-report-class instance in the PhysX scene, so each contact that occurs will call the OnContact callback in the supplied class instance.
Icon attributes.png  RemoveContantReport Removes a contact report class instance from the contact notifications list
Icon attributes.png  GetTerrainMaterialIndex Returns the material index IDs for the terrain actor
Icon attributes.png  GetClosestHitPoint Finds the closest hit point from a defined position, in a defined direction
Icon attributes.png  GetClosestHitPointSpecificObjectType Finds the closest hit point from a defined position, in a defined direction, on a defined simulation object type
Icon attributes.png  GetClosestHitPointIgnoreSpecificObjectType Finds the closest hit point from a defined position, in a defined direction, ignoring a defined simulation object type