22#include "flat/physics/material.h"
25#include "PxPhysicsAPI.h"
245 Physics::ColliderType
type = Physics::ColliderType_Capsule;
299 Physics::ColliderType
type = Physics::ColliderType_Box;
315 Physics::MeshTopology
topology = Physics::MeshTopology_Triangles;
341 Physics::CollisionFeedback
feedback = Physics::CollisionFeedback_Full;
Nebula's dynamic array class.
Definition array.h:61
Implements large bit field.
Definition bitfield.h:43
Nebula delegate class, allows to store a function, method or lambda call into a C++ object for later ...
Definition delegate.h:39
A collection of unique values with quick lookup.
Definition set.h:34
A StringAtom.
Definition stringatom.h:22
Nebula's universal string class.
Definition string.h:50
This simple Id pool implements a set of free and used consecutive integers.
Definition id.h:135
uint32_t Id32
Definition id.h:138
Diverse functions for manipulating physics actors.
Definition actorcontext.cc:22
void SetActiveActorCallback(UpdateFunctionType callback, IndexT sceneId)
called once per step for every actor PhysX reported active on that step
Definition physicsinterface.cc:230
Util::BitField< CharacterCollisionBitsMax > CharacterCollision
Definition physicsinterface.h:52
Physics::Scene & GetScene(IndexT idx)
Definition physicsinterface.cc:210
void(*)(const CharacterHitEvent &) CharacterHitCallbackType
Definition physicsinterface.h:166
ActorType
Definition physicsinterface.h:38
@ Static
Definition physicsinterface.h:39
@ Dynamic
Definition physicsinterface.h:41
@ Kinematic
Definition physicsinterface.h:40
void RenderDebug()
render a debug visualization of the level
Definition physicsinterface.cc:240
SizeT GetNrMaterials()
Definition physicsinterface.cc:362
void ShutDown()
close the physics subsystem
Definition physicsinterface.cc:98
void SetEventCallback(EventCallbackType callback, IndexT sceneId)
Definition physicsinterface.cc:220
Physics::Material & GetMaterial(IndexT idx)
Definition physicsinterface.cc:290
AxisLockBits
Definition physicsinterface.h:55
@ LockLinearZ
Definition physicsinterface.h:58
@ LockAngularX
Definition physicsinterface.h:59
@ LockAngularY
Definition physicsinterface.h:60
@ LockLinearX
Definition physicsinterface.h:56
@ LockLinearY
Definition physicsinterface.h:57
@ AxisLockBitsMax
Definition physicsinterface.h:62
@ LockAngularZ
Definition physicsinterface.h:61
ActorId CreateActorInstance(Physics::ActorResourceId id, Math::transform const &trans, Physics::ActorType type, uint64_t userData, IndexT scene)
Definition physicsinterface.cc:390
void Setup()
initialize the physics subsystem and create a default scene
Definition physicsinterface.cc:67
void SetOnSleepCallback(Util::Delegate< void(ActorId *id, SizeT num)> const &callback)
Definition physicsinterface.cc:303
CharacterCollisionBits
Definition physicsinterface.h:45
@ Sides
Definition physicsinterface.h:46
@ Up
Definition physicsinterface.h:47
@ CharacterCollisionBitsMax
Definition physicsinterface.h:49
@ Down
Definition physicsinterface.h:48
Util::BitField< 16 > AxisLock
Definition physicsinterface.h:65
void DestroyActorInstance(Physics::ActorId id)
Definition physicsinterface.cc:399
void DestroyScene(IndexT sceneId)
Definition physicsinterface.cc:160
void(*)(const Actor &) UpdateFunctionType
Definition physicsinterface.h:208
void SetOnWakeCallback(Util::Delegate< void(ActorId *id, SizeT num)> const &callback)
Definition physicsinterface.cc:312
void Step(Timing::Time delta)
perform a sync simulation step on every scene
Definition physicsinterface.cc:372
IndexT SetPhysicsMaterial(Util::StringAtom name, float staticFriction, float dynamicFriction, float restitution, float density)
Definition physicsinterface.cc:321
IndexT CreateScene()
Definition physicsinterface.cc:107
IndexT LookupMaterial(Util::StringAtom name)
Definition physicsinterface.cc:353
void(*)(const Util::Array< ContactEvent > &) EventCallbackType
Definition physicsinterface.h:221
double Time
the time datatype
Definition time.h:18
#define RESOURCE_ID_TYPE(type)
Definition resourceid.h:41
Represents a 3D point in space.
Definition point.h:22
A 3D vector.
Definition vec3.h:37
A vector is a 3D direction in space.
Definition vector.h:22
Definition physicsinterface.h:112
Util::Array< ShapeId > shapes
Definition physicsinterface.h:121
AxisLock axisLock
Definition physicsinterface.h:125
bool ownsActor
false when this context only holds a record for the actor and not the actor itself,...
Definition physicsinterface.h:119
physx::PxActor * actor
Definition physicsinterface.h:113
ActorResourceId res
Definition physicsinterface.h:115
uint64_t userData
Definition physicsinterface.h:126
ActorId id
Definition physicsinterface.h:114
float mass
Definition physicsinterface.h:122
uint32_t collisionGroup
Definition physicsinterface.h:123
uint32_t feedback
Definition physicsinterface.h:124
Definition physicsinterface.h:76
ActorId()
Definition physicsinterface.h:78
ActorId(uint32_t i)
Definition physicsinterface.h:79
Ids::Id32 id
Definition physicsinterface.h:77
Definition physicsinterface.h:32
Definition physicsinterface.h:201
AggregateResourceId res
Definition physicsinterface.h:203
AggregateId id
Definition physicsinterface.h:202
Util::Array< ActorId > actors
Definition physicsinterface.h:204
Util::Array< ConstraintId > constraints
Definition physicsinterface.h:205
Definition physicsinterface.h:97
AggregateId()
Definition physicsinterface.h:99
AggregateId(uint32_t i)
Definition physicsinterface.h:100
Ids::Id32 id
Definition physicsinterface.h:98
Definition physicsinterface.h:33
A physics body description.
Definition physicsinterface.h:328
Physics::CollisionFeedback feedback
Definition physicsinterface.h:341
float linearDamping
Definition physicsinterface.h:335
float mass
0 means the mass is derived from the shape volumes and the material densities
Definition physicsinterface.h:334
uint64_t userData
Definition physicsinterface.h:346
Physics::ActorType type
Definition physicsinterface.h:329
AxisLock axisLock
the world space axes the body is locked along or around.
Definition physicsinterface.h:344
bool ccd
Definition physicsinterface.h:338
IndexT scene
Definition physicsinterface.h:330
Math::transform transform
Definition physicsinterface.h:331
uint32_t collisionGroup
Definition physicsinterface.h:340
float angularDamping
Definition physicsinterface.h:336
bool useGravity
Definition physicsinterface.h:337
Definition physicsinterface.h:237
Math::float3 halfExtents
Half the width, height and depth of the characters AABB collider.
Definition physicsinterface.h:239
Definition physicsinterface.h:226
float radius
Radius of this capsule.
Definition physicsinterface.h:228
bool constrainClimbing
If set to false, the capsule will climb over surfaces according to impact normal.
Definition physicsinterface.h:234
float height
Height of this capsule. The total height will be height + 2 * radius.
Definition physicsinterface.h:230
Definition physicsinterface.h:224
float contactOffset
The contact offset used by the controller.
Definition physicsinterface.h:256
float slopeLimit
The maximum slope which the character can walk up. Defined as cosine of desired limit angle.
Definition physicsinterface.h:248
Physics::ColliderType type
Determines the type of collider that the character will use.
Definition physicsinterface.h:245
float stepOffset
The maximum height of an obstacle which the character can climb.
Definition physicsinterface.h:259
uint32_t collisionMask
The set of groups the controller accepts when it moves, matched against word0 of the hit shape's filt...
Definition physicsinterface.h:273
uint64_t userData
Can be used to store application side information in the character.
Definition physicsinterface.h:283
CharacterHitCallbackType reportCallback
Called for every shape the controller hits during move.
Definition physicsinterface.h:287
IndexT materialId
Optional physics material to use.
Definition physicsinterface.h:264
bool slideOnSlopes
Should the character slide down slopes?
Definition physicsinterface.h:251
uint32_t collisionGroup
word0 of the shape's filter data, which is what the simulation filter shader reads.
Definition physicsinterface.h:268
A shape a character controller hit during its move.
Definition physicsinterface.h:156
float distance
Definition physicsinterface.h:163
Math::vector normal
Definition physicsinterface.h:162
ShapeId shape
Definition physicsinterface.h:159
CharacterId character
Definition physicsinterface.h:157
ActorId actor
Definition physicsinterface.h:158
Math::point position
Definition physicsinterface.h:161
Definition physicsinterface.h:169
uint64_t userData
Definition physicsinterface.h:186
ShapeId shape
Definition physicsinterface.h:178
uint32_t collisionMask
Definition physicsinterface.h:181
uint32_t collisionGroup
Definition physicsinterface.h:180
ActorId actor
The controller owns a physx actor internally.
Definition physicsinterface.h:177
CharacterId id
Definition physicsinterface.h:172
CharacterHitCallbackType reportCallback
the report the create info carried, kept so the hit report can be forwarded without a lookup
Definition physicsinterface.h:184
physx::PxController * controller
Definition physicsinterface.h:170
Physics::ColliderType type
Definition physicsinterface.h:171
Definition physicsinterface.h:83
CharacterId()
Definition physicsinterface.h:85
CharacterId(uint32_t i)
Definition physicsinterface.h:86
Ids::Id32 id
Definition physicsinterface.h:84
A collider description / create info.
Definition physicsinterface.h:298
float targetSizeY
Definition physicsinterface.h:318
IndexT primGroup
Definition physicsinterface.h:314
float capsuleRadius
Definition physicsinterface.h:309
float targetSizeX
Definition physicsinterface.h:317
uint64_t userData
Definition physicsinterface.h:320
bool isTrigger
Definition physicsinterface.h:301
Math::transform transform
local transform of the shape, relative to the actor it belongs to
Definition physicsinterface.h:304
float sphereRadius
Definition physicsinterface.h:308
Util::StringAtom resource
mesh and heightfield geometry is read through the geometry loader, from a URN such as folder:file:msh
Definition physicsinterface.h:313
IndexT materialId
Definition physicsinterface.h:300
Physics::ColliderType type
Definition physicsinterface.h:299
float capsuleHalfHeight
Definition physicsinterface.h:310
Math::vec3 boxExtents
shape parameters. Only the ones matching the collider type are read
Definition physicsinterface.h:307
Physics::MeshTopology topology
Definition physicsinterface.h:315
float heightRange
Definition physicsinterface.h:316
Definition physicsinterface.h:193
ConstraintId id
Definition physicsinterface.h:194
Ids::Id32 res
Definition physicsinterface.h:195
uint64_t userData
Definition physicsinterface.h:197
physx::PxJoint * joint
Definition physicsinterface.h:196
Definition physicsinterface.h:90
Ids::Id32 id
Definition physicsinterface.h:91
ConstraintId(uint32_t i)
Definition physicsinterface.h:93
ConstraintId()
Definition physicsinterface.h:92
Definition physicsinterface.h:35
Definition physicsinterface.h:68
Util::StringAtom name
Definition physicsinterface.h:70
physx::PxMaterial * material
Definition physicsinterface.h:69
uint64_t serialId
Definition physicsinterface.h:71
float density
Definition physicsinterface.h:72
Definition physicsinterface.h:34
physx scene classes, foundation and physics are duplicated here for convenience instead of static get...
Definition physicsinterface.h:352
physx::PxFoundation * foundation
Definition physicsinterface.h:353
UpdateFunctionType updateFunction
Definition physicsinterface.h:358
physx::PxPhysics * physics
Definition physicsinterface.h:354
Util::Set< Ids::Id32 > activeActors
Definition physicsinterface.h:361
EventCallbackType eventCallback
Definition physicsinterface.h:359
physx::PxDefaultCpuDispatcher * dispatcher
Definition physicsinterface.h:357
Util::Array< Physics::ContactEvent > eventBuffer
Definition physicsinterface.h:360
physx::PxScene * scene
Definition physicsinterface.h:355
physx::PxControllerManager * controllerManager
Definition physicsinterface.h:356
Definition physicsinterface.h:134
IndexT materialId
Definition physicsinterface.h:138
ActorId actor
Definition physicsinterface.h:137
uint64_t geometryHash
hash of the description the current geometry was built from, used to detect changes
Definition physicsinterface.h:141
physx::PxShape * shape
Definition physicsinterface.h:135
uint64_t userData
Definition physicsinterface.h:142
bool isTrigger
Definition physicsinterface.h:139
ShapeId id
Definition physicsinterface.h:136
Definition physicsinterface.h:104
Ids::Id32 id
Definition physicsinterface.h:105
ShapeId(uint32_t i)
Definition physicsinterface.h:107
const bool operator==(const ShapeId &rhs) const
Definition physicsinterface.h:108
ShapeId()
Definition physicsinterface.h:106
Typedefs for the Timing subsystem.
int SizeT
Definition types.h:50
int IndexT
Definition types.h:49
CapsuleInfo capsule
Capsule information. Make sure to set type to Capsule if using this.
BoxInfo box
AABB information. Make sure to set type to Box if using this.