// // Generated by Brutal.Jolt.Generate; do not edit by hand. #nullable enable using Brutal.Interop; using Brutal.Numerics; namespace Brutal.JoltApi { /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:204 ///
/// class CharacterVirtual : public CharacterBase ///
///
/// /// /// Runtime character object. /// This object usually represents the player. Contrary to the Character class it doesn't use a rigid body but moves doing collision checks only (hence the name virtual). /// The advantage of this is that you can determine when the character moves in the frame (usually this has to happen at a very particular point in the frame) /// but the downside is that other objects don't see this virtual character. To make a CharacterVirtual visible to the simulation, you can optionally create an inner /// rigid body through CharacterVirtualSettings::mInnerBodyShape. A CharacterVirtual is not tracked by the PhysicsSystem so you need to update it yourself. This also means /// that a call to PhysicsSystem::SaveState will not save its state, you need to call CharacterVirtual::SaveState yourself. /// /// [InteropHandle] public readonly partial struct CharacterVirtual : IDisposable { /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:365 ///
/// struct ExtendedUpdateSettings ///
///
/// /// /// Settings struct with settings for ExtendedUpdate /// /// [StructLayout(LayoutKind.Explicit, Size = 64)] public struct ExtendedUpdateSettings { /// /// /// See StickToFloor inStepDown parameter. Can be zero to turn off. /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:367 ///
/// Vec3 mStickToFloorStepDown { 0, -0.5f, 0 } ///
///
[FieldOffset(0)] public float3 mStickToFloorStepDown; /// /// /// See WalkStairs inStepUp parameter. Can be zero to turn off. /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:368 ///
/// Vec3 mWalkStairsStepUp { 0, 0.4f, 0 } ///
///
[FieldOffset(16)] public float3 mWalkStairsStepUp; /// /// /// See WalkStairs inStepForward parameter. Note that the parameter only indicates a magnitude, /// direction is taken from current velocity. /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:369 ///
/// float mWalkStairsMinStepForward { 0.02f } ///
///
[FieldOffset(32)] public float mWalkStairsMinStepForward; /// /// /// See WalkStairs inStepForwardTest parameter. Note that the parameter only indicates a magnitude, /// direction is taken from current velocity. /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:370 ///
/// float mWalkStairsStepForwardTest { 0.15f } ///
///
[FieldOffset(36)] public float mWalkStairsStepForwardTest; /// /// /// Cos(angle) where angle is the maximum angle between the ground normal in the horizontal plane and /// the character forward vector where we're willing to adjust the step forward test towards the contact /// normal. /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:371 ///
/// float mWalkStairsCosAngleForwardContact { Cos(DegreesToRadians(75.0f)) } ///
///
[FieldOffset(40)] public float mWalkStairsCosAngleForwardContact; /// /// /// See WalkStairs inStepDownExtra /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:372 ///
/// Vec3 mWalkStairsStepDownExtra { Vec3::sZero() } ///
///
[FieldOffset(48)] public float3 mWalkStairsStepDownExtra; } /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:483 ///
/// struct Contact : public ContactKey ///
///
/// /// /// Encapsulates a collision contact /// /// [StructLayout(LayoutKind.Explicit, Size = 128)] public struct Contact { /// /// /// Position where the character makes contact /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:489 ///
/// RVec3 mPosition ///
///
[FieldOffset(16)] public float3 mPosition; /// /// /// Velocity of the contact point /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:490 ///
/// Vec3 mLinearVelocity ///
///
[FieldOffset(32)] public float3 mLinearVelocity; /// /// /// Contact normal, pointing towards the character /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:491 ///
/// Vec3 mContactNormal ///
///
[FieldOffset(48)] public float3 mContactNormal; /// /// /// Surface normal of the contact /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:492 ///
/// Vec3 mSurfaceNormal ///
///
[FieldOffset(64)] public float3 mSurfaceNormal; /// /// /// Distance to the contact <= 0 means that it is an actual contact, > 0 means predictive /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:493 ///
/// float mDistance ///
///
[FieldOffset(80)] public float mDistance; /// /// /// Fraction along the path where this contact takes place /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:494 ///
/// float mFraction ///
///
[FieldOffset(84)] public float mFraction; /// /// /// Motion type of B, used to determine the priority of the contact /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:495 ///
/// EMotionType mMotionTypeB ///
///
[FieldOffset(88)] public EMotionType mMotionTypeB; /// /// /// If B is a sensor /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:496 ///
/// bool mIsSensorB ///
///
[FieldOffset(89)] public Brutal.Bool8 mIsSensorB; /// /// /// Character we're colliding with (if not nullptr). Note that this may be a dangling pointer when /// accessed through GetActiveContacts(), use mCharacterIDB instead. /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:497 ///
/// const CharacterVirtual * mCharacterB = nullptr ///
///
[FieldOffset(96)] public CharacterVirtual mCharacterB; /// /// /// User data of B /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:498 ///
/// uint64 mUserData ///
///
[FieldOffset(104)] public ulong mUserData; /// /// /// Material of B /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:499 ///
/// const PhysicsMaterial * mMaterial ///
///
[FieldOffset(112)] public PhysicsMaterial mMaterial; /// /// /// If the character actually collided with the contact (can be false if a predictive contact never /// becomes a real one) /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:500 ///
/// bool mHadCollision = false ///
///
[FieldOffset(120)] public Brutal.Bool8 mHadCollision; /// /// /// If the contact validate callback chose to discard this contact or when the body is a sensor /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:501 ///
/// bool mWasDiscarded = false ///
///
[FieldOffset(121)] public Brutal.Bool8 mWasDiscarded; /// /// /// When true, the velocity of the contact point can push the character /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:502 ///
/// bool mCanPushCharacter = true ///
///
[FieldOffset(122)] public Brutal.Bool8 mCanPushCharacter; } /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:215 ///
/// CharacterVirtual(const CharacterVirtualSettings *inSettings, RVec3Arg inPosition, QuatArg inRotation, uint64 inUserData, PhysicsSystem *inSystem) ///
///
/// /// /// Constructor /// @param inSettings The settings for the character /// @param inPosition Initial position for the character /// @param inRotation Initial rotation for the character (usually only around the up-axis) /// @param inUserData Application specific value /// @param inSystem Physics system that this character will be added to /// /// public static CharacterVirtual Create(CharacterVirtualSettings settings, float3 position, floatQuat rotation, ulong userData, PhysicsSystem system) => Jolt.PInvoke.CharacterVirtual_Create(settings, position, rotation, userData, system); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:218 ///
/// CharacterVirtual(const CharacterVirtualSettings *inSettings, RVec3Arg inPosition, QuatArg inRotation, PhysicsSystem *inSystem) ///
///
/// /// /// Constructor without user data /// /// public static CharacterVirtual Create(CharacterVirtualSettings settings, float3 position, floatQuat rotation, PhysicsSystem system) => Jolt.PInvoke.CharacterVirtual_Create_2(settings, position, rotation, system); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:224 ///
/// inline const CharacterID & GetID() const ///
///
/// /// /// The ID of this character /// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// public CharacterID GetID() => Jolt.PInvoke.CharacterVirtual_GetID(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:227 ///
/// void SetListener(CharacterContactListener *inListener) ///
///
/// /// /// Set the contact listener /// /// public void SetListener(CharacterContactListener listener) => Jolt.PInvoke.CharacterVirtual_SetListener(this, listener); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:230 ///
/// CharacterContactListener * GetListener() const ///
///
/// /// /// Get the current contact listener /// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// public CharacterContactListener GetListener() => Jolt.PInvoke.CharacterVirtual_GetListener(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:233 ///
/// void SetCharacterVsCharacterCollision(CharacterVsCharacterCollision *inCharacterVsCharacterCollision) ///
///
/// /// /// Set the character vs character collision interface /// /// public void SetCharacterVsCharacterCollision(CharacterVsCharacterCollision characterVsCharacterCollision) => Jolt.PInvoke.CharacterVirtual_SetCharacterVsCharacterCollision(this, characterVsCharacterCollision); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:236 ///
/// Vec3 GetLinearVelocity() const ///
///
/// /// /// Get the linear velocity of the character (m / s) /// /// public float3 GetLinearVelocity() => Jolt.PInvoke.CharacterVirtual_GetLinearVelocity(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:239 ///
/// void SetLinearVelocity(Vec3Arg inLinearVelocity) ///
///
/// /// /// Set the linear velocity of the character (m / s) /// /// public void SetLinearVelocity(float3 linearVelocity) => Jolt.PInvoke.CharacterVirtual_SetLinearVelocity(this, linearVelocity); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:242 ///
/// RVec3 GetPosition() const ///
///
/// /// /// Get the position of the character /// /// public float3 GetPosition() => Jolt.PInvoke.CharacterVirtual_GetPosition(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:245 ///
/// void SetPosition(RVec3Arg inPosition) ///
///
/// /// /// Set the position of the character /// /// public void SetPosition(float3 position) => Jolt.PInvoke.CharacterVirtual_SetPosition(this, position); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:248 ///
/// Quat GetRotation() const ///
///
/// /// /// Get the rotation of the character /// /// public floatQuat GetRotation() => Jolt.PInvoke.CharacterVirtual_GetRotation(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:251 ///
/// void SetRotation(QuatArg inRotation) ///
///
/// /// /// Set the rotation of the character /// /// public void SetRotation(floatQuat rotation) => Jolt.PInvoke.CharacterVirtual_SetRotation(this, rotation); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:254 ///
/// inline RVec3 GetCenterOfMassPosition() const ///
///
/// /// /// Get the center of mass position of the shape /// /// public float3 GetCenterOfMassPosition() => Jolt.PInvoke.CharacterVirtual_GetCenterOfMassPosition(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:257 ///
/// RMat44 GetWorldTransform() const ///
///
/// /// /// Calculate the world transform of the character /// /// public float4x4 GetWorldTransform() => Jolt.PInvoke.CharacterVirtual_GetWorldTransform(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:260 ///
/// RMat44 GetCenterOfMassTransform() const ///
///
/// /// /// Calculates the transform for this character's center of mass /// /// public float4x4 GetCenterOfMassTransform() => Jolt.PInvoke.CharacterVirtual_GetCenterOfMassTransform(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:263 ///
/// float GetMass() const ///
///
/// /// /// Character mass (kg) /// /// public float GetMass() => Jolt.PInvoke.CharacterVirtual_GetMass(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:264 ///
/// void SetMass(float inMass) ///
///
public void SetMass(float mass) => Jolt.PInvoke.CharacterVirtual_SetMass(this, mass); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:267 ///
/// float GetMaxStrength() const ///
///
/// /// /// Maximum force with which the character can push other bodies (N) /// /// public float GetMaxStrength() => Jolt.PInvoke.CharacterVirtual_GetMaxStrength(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:268 ///
/// void SetMaxStrength(float inMaxStrength) ///
///
public void SetMaxStrength(float maxStrength) => Jolt.PInvoke.CharacterVirtual_SetMaxStrength(this, maxStrength); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:271 ///
/// float GetPenetrationRecoverySpeed() const ///
///
/// /// /// This value governs how fast a penetration will be resolved, 0 = nothing is resolved, 1 = everything in /// one update /// /// public float GetPenetrationRecoverySpeed() => Jolt.PInvoke.CharacterVirtual_GetPenetrationRecoverySpeed(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:272 ///
/// void SetPenetrationRecoverySpeed(float inSpeed) ///
///
public void SetPenetrationRecoverySpeed(float speed) => Jolt.PInvoke.CharacterVirtual_SetPenetrationRecoverySpeed(this, speed); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:275 ///
/// bool GetEnhancedInternalEdgeRemoval() const ///
///
/// /// /// Set to indicate that extra effort should be made to try to remove ghost contacts (collisions with /// internal edges of a mesh). This is more expensive but makes bodies move smoother over a mesh with convex /// edges. /// /// public bool GetEnhancedInternalEdgeRemoval() => Jolt.PInvoke.CharacterVirtual_GetEnhancedInternalEdgeRemoval(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:276 ///
/// void SetEnhancedInternalEdgeRemoval(bool inApply) ///
///
public void SetEnhancedInternalEdgeRemoval(bool apply) => Jolt.PInvoke.CharacterVirtual_SetEnhancedInternalEdgeRemoval(this, apply); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:279 ///
/// float GetCharacterPadding() const ///
///
/// /// /// Character padding /// /// public float GetCharacterPadding() => Jolt.PInvoke.CharacterVirtual_GetCharacterPadding(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:282 ///
/// uint GetMaxNumHits() const ///
///
/// /// /// Max num hits to collect in order to avoid excess of contact points collection /// /// public uint GetMaxNumHits() => Jolt.PInvoke.CharacterVirtual_GetMaxNumHits(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:283 ///
/// void SetMaxNumHits(uint inMaxHits) ///
///
public void SetMaxNumHits(uint maxHits) => Jolt.PInvoke.CharacterVirtual_SetMaxNumHits(this, maxHits); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:286 ///
/// float GetHitReductionCosMaxAngle() const ///
///
/// /// /// Cos(angle) where angle is the maximum angle between two hits contact normals that are allowed to be /// merged during hit reduction. Default is around 2.5 degrees. Set to -1 to turn off. /// /// public float GetHitReductionCosMaxAngle() => Jolt.PInvoke.CharacterVirtual_GetHitReductionCosMaxAngle(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:287 ///
/// void SetHitReductionCosMaxAngle(float inCosMaxAngle) ///
///
public void SetHitReductionCosMaxAngle(float cosMaxAngle) => Jolt.PInvoke.CharacterVirtual_SetHitReductionCosMaxAngle(this, cosMaxAngle); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:293 ///
/// bool GetMaxHitsExceeded() const ///
///
/// /// /// Returns if we exceeded the maximum number of hits during the last collision check and had to discard hits based on distance. /// This can be used to find areas that have too complex geometry for the character to navigate properly. /// To solve you can either increase the max number of hits or simplify the geometry. Note that the character simulation will /// try to do its best to select the most relevant contacts to avoid the character from getting stuck. /// /// public bool GetMaxHitsExceeded() => Jolt.PInvoke.CharacterVirtual_GetMaxHitsExceeded(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:296 ///
/// Vec3 GetShapeOffset() const ///
///
/// /// /// An extra offset applied to the shape in local space. This allows applying an extra offset to the shape /// in local space. Note that setting it on the fly can cause the shape to teleport into collision. /// /// public float3 GetShapeOffset() => Jolt.PInvoke.CharacterVirtual_GetShapeOffset(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:297 ///
/// void SetShapeOffset(Vec3Arg inShapeOffset) ///
///
public void SetShapeOffset(float3 shapeOffset) => Jolt.PInvoke.CharacterVirtual_SetShapeOffset(this, shapeOffset); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:300 ///
/// uint64 GetUserData() const ///
///
/// /// /// Access to the user data, can be used for anything by the application /// /// public ulong GetUserData() => Jolt.PInvoke.CharacterVirtual_GetUserData(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:301 ///
/// void SetUserData(uint64 inUserData) ///
///
public void SetUserData(ulong userData) => Jolt.PInvoke.CharacterVirtual_SetUserData(this, userData); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:304 ///
/// BodyID GetInnerBodyID() const ///
///
/// /// /// Optional inner rigid body that proxies the character in the world. Can be used to update body /// properties. /// /// public uint GetInnerBodyID() => Jolt.PInvoke.CharacterVirtual_GetInnerBodyID(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:310 ///
/// Vec3 CancelVelocityTowardsSteepSlopes(Vec3Arg inDesiredVelocity) const ///
///
/// /// /// This function can be called prior to calling Update() to convert a desired velocity into a velocity that won't make the character move further onto steep slopes. /// This velocity can then be set on the character using SetLinearVelocity() /// @param inDesiredVelocity Velocity to clamp against steep walls /// @return A new velocity vector that won't make the character move up steep slopes /// /// public float3 CancelVelocityTowardsSteepSlopes(float3 desiredVelocity) => Jolt.PInvoke.CharacterVirtual_CancelVelocityTowardsSteepSlopes(this, desiredVelocity); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:316 ///
/// void StartTrackingContactChanges() ///
///
/// /// /// This function is internally called by Update, WalkStairs, StickToFloor and ExtendedUpdate and is responsible for tracking if contacts are added, persisted or removed. /// If you want to do multiple operations on a character (e.g. first Update then WalkStairs), you can surround the code with a StartTrackingContactChanges and FinishTrackingContactChanges pair /// to only receive a single callback per contact on the CharacterContactListener. If you don't do this then you could for example receive a contact added callback during the Update and a /// contact persisted callback during WalkStairs. /// /// public void StartTrackingContactChanges() => Jolt.PInvoke.CharacterVirtual_StartTrackingContactChanges(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:319 ///
/// void FinishTrackingContactChanges() ///
///
/// /// /// This call triggers contact removal callbacks and is used in conjunction with /// StartTrackingContactChanges. /// /// public void FinishTrackingContactChanges() => Jolt.PInvoke.CharacterVirtual_FinishTrackingContactChanges(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:331 ///
/// void Update(float inDeltaTime, Vec3Arg inGravity, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter, const BodyFilter &inBodyFilter, const ShapeFilter &inShapeFilter, TempAllocator &inAllocator) ///
///
/// /// /// This is the main update function. It moves the character according to its current velocity (the character is similar to a kinematic body in the sense /// that you set the velocity and the character will follow unless collision is blocking the way). Note it's your own responsibility to apply gravity to the character velocity! /// Different surface materials (like ice) can be emulated by getting the ground material and adjusting the velocity and/or the max slope angle accordingly every frame. /// @param inDeltaTime Time step to simulate. /// @param inGravity Gravity vector (m/s^2). This gravity vector is only used when the character is standing on top of another object to apply downward force. /// @param inBroadPhaseLayerFilter Filter that is used to check if the character collides with something in the broadphase. /// @param inObjectLayerFilter Filter that is used to check if a character collides with a layer. /// @param inBodyFilter Filter that is used to check if a character collides with a body. /// @param inShapeFilter Filter that is used to check if a character collides with a subshape. /// @param inAllocator An allocator for temporary allocations. All memory will be freed by the time this function returns. /// /// public void Update(float deltaTime, float3 gravity, BroadPhaseLayerFilter broadPhaseLayerFilter, ObjectLayerFilter objectLayerFilter, BodyFilter bodyFilter, ShapeFilter shapeFilter, TempAllocator allocator) => Jolt.PInvoke.CharacterVirtual_Update(this, deltaTime, gravity, broadPhaseLayerFilter, objectLayerFilter, bodyFilter, shapeFilter, allocator); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:336 ///
/// bool CanWalkStairs(Vec3Arg inLinearVelocity) const ///
///
/// /// /// This function will return true if the character has moved into a slope that is too steep (e.g. a vertical wall). /// You would call WalkStairs to attempt to step up stairs. /// @param inLinearVelocity The linear velocity that the player desired. This is used to determine if we're pushing into a step. /// /// public bool CanWalkStairs(float3 linearVelocity) => Jolt.PInvoke.CharacterVirtual_CanWalkStairs(this, linearVelocity); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:350 ///
/// bool WalkStairs(float inDeltaTime, Vec3Arg inStepUp, Vec3Arg inStepForward, Vec3Arg inStepForwardTest, Vec3Arg inStepDownExtra, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter, const BodyFilter &inBodyFilter, const ShapeFilter &inShapeFilter, TempAllocator &inAllocator) ///
///
/// /// /// When stair walking is needed, you can call the WalkStairs function to cast up, forward and down again to try to find a valid position /// @param inDeltaTime Time step to simulate. /// @param inStepUp The direction and distance to step up (this corresponds to the max step height) /// @param inStepForward The direction and distance to step forward after the step up /// @param inStepForwardTest When running at a high frequency, inStepForward can be very small and it's likely that you hit the side of the stairs on the way down. This could produce a normal that violates the max slope angle. If this happens, we test again using this distance from the up position to see if we find a valid slope. /// @param inStepDownExtra An additional translation that is added when stepping down at the end. Allows you to step further down than up. Set to zero if you don't want this. Should be in the opposite direction of up. /// @param inBroadPhaseLayerFilter Filter that is used to check if the character collides with something in the broadphase. /// @param inObjectLayerFilter Filter that is used to check if a character collides with a layer. /// @param inBodyFilter Filter that is used to check if a character collides with a body. /// @param inShapeFilter Filter that is used to check if a character collides with a subshape. /// @param inAllocator An allocator for temporary allocations. All memory will be freed by the time this function returns. /// @return true if the stair walk was successful /// /// public bool WalkStairs(float deltaTime, float3 stepUp, float3 stepForward, float3 stepForwardTest, float3 stepDownExtra, BroadPhaseLayerFilter broadPhaseLayerFilter, ObjectLayerFilter objectLayerFilter, BodyFilter bodyFilter, ShapeFilter shapeFilter, TempAllocator allocator) => Jolt.PInvoke.CharacterVirtual_WalkStairs(this, deltaTime, stepUp, stepForward, stepForwardTest, stepDownExtra, broadPhaseLayerFilter, objectLayerFilter, bodyFilter, shapeFilter, allocator); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:362 ///
/// bool StickToFloor(Vec3Arg inStepDown, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter, const BodyFilter &inBodyFilter, const ShapeFilter &inShapeFilter, TempAllocator &inAllocator) ///
///
/// /// /// This function can be used to artificially keep the character to the floor. Normally when a character is on a small step and starts moving horizontally, the character will /// lose contact with the floor because the initial vertical velocity is zero while the horizontal velocity is quite high. To prevent the character from losing contact with the floor, /// we do an additional collision check downwards and if we find the floor within a certain distance, we project the character onto the floor. /// @param inStepDown Max amount to project the character downwards (if no floor is found within this distance, the function will return false) /// @param inBroadPhaseLayerFilter Filter that is used to check if the character collides with something in the broadphase. /// @param inObjectLayerFilter Filter that is used to check if a character collides with a layer. /// @param inBodyFilter Filter that is used to check if a character collides with a body. /// @param inShapeFilter Filter that is used to check if a character collides with a subshape. /// @param inAllocator An allocator for temporary allocations. All memory will be freed by the time this function returns. /// @return True if the character was successfully projected onto the floor. /// /// public bool StickToFloor(float3 stepDown, BroadPhaseLayerFilter broadPhaseLayerFilter, ObjectLayerFilter objectLayerFilter, BodyFilter bodyFilter, ShapeFilter shapeFilter, TempAllocator allocator) => Jolt.PInvoke.CharacterVirtual_StickToFloor(this, stepDown, broadPhaseLayerFilter, objectLayerFilter, bodyFilter, shapeFilter, allocator); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:387 ///
/// void ExtendedUpdate(float inDeltaTime, Vec3Arg inGravity, const ExtendedUpdateSettings &inSettings, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter, const BodyFilter &inBodyFilter, const ShapeFilter &inShapeFilter, TempAllocator &inAllocator) ///
///
/// /// /// This function combines Update, StickToFloor and WalkStairs. This function serves as an example of how these functions could be combined. /// Before calling, call SetLinearVelocity to update the horizontal/vertical speed of the character, typically this is: /// - When on OnGround and not moving away from ground: velocity = GetGroundVelocity() + horizontal speed as input by player + optional vertical jump velocity + delta time * gravity /// - Else: velocity = current vertical velocity + horizontal speed as input by player + delta time * gravity /// @param inDeltaTime Time step to simulate. /// @param inGravity Gravity vector (m/s^2). This gravity vector is only used when the character is standing on top of another object to apply downward force. /// @param inSettings A structure containing settings for the algorithm. /// @param inBroadPhaseLayerFilter Filter that is used to check if the character collides with something in the broadphase. /// @param inObjectLayerFilter Filter that is used to check if a character collides with a layer. /// @param inBodyFilter Filter that is used to check if a character collides with a body. /// @param inShapeFilter Filter that is used to check if a character collides with a subshape. /// @param inAllocator An allocator for temporary allocations. All memory will be freed by the time this function returns. /// /// public void ExtendedUpdate(float deltaTime, float3 gravity, ref CharacterVirtual.ExtendedUpdateSettings settings, BroadPhaseLayerFilter broadPhaseLayerFilter, ObjectLayerFilter objectLayerFilter, BodyFilter bodyFilter, ShapeFilter shapeFilter, TempAllocator allocator) => Jolt.PInvoke.CharacterVirtual_ExtendedUpdate(this, deltaTime, gravity, ref settings, broadPhaseLayerFilter, objectLayerFilter, bodyFilter, shapeFilter, allocator); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:390 ///
/// void RefreshContacts(const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter, const BodyFilter &inBodyFilter, const ShapeFilter &inShapeFilter, TempAllocator &inAllocator) ///
///
/// /// /// This function can be used after a character has teleported to determine the new contacts with the world. /// /// public void RefreshContacts(BroadPhaseLayerFilter broadPhaseLayerFilter, ObjectLayerFilter objectLayerFilter, BodyFilter bodyFilter, ShapeFilter shapeFilter, TempAllocator allocator) => Jolt.PInvoke.CharacterVirtual_RefreshContacts(this, broadPhaseLayerFilter, objectLayerFilter, bodyFilter, shapeFilter, allocator); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:394 ///
/// void UpdateGroundVelocity() ///
///
/// /// /// Use the ground body ID to get an updated estimate of the ground velocity. This function can be used if the ground body has moved / changed velocity and you want a new estimate of the ground velocity. /// It will not perform collision detection, so is less accurate than RefreshContacts but a lot faster. /// /// public void UpdateGroundVelocity() => Jolt.PInvoke.CharacterVirtual_UpdateGroundVelocity(this); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:405 ///
/// bool SetShape(const Shape *inShape, float inMaxPenetrationDepth, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter, const BodyFilter &inBodyFilter, const ShapeFilter &inShapeFilter, TempAllocator &inAllocator) ///
///
/// /// /// Switch the shape of the character (e.g. for stance). /// @param inShape The shape to switch to. /// @param inMaxPenetrationDepth When inMaxPenetrationDepth is not FLT_MAX, it checks if the new shape collides before switching shape. This is the max penetration we're willing to accept after the switch. /// @param inBroadPhaseLayerFilter Filter that is used to check if the character collides with something in the broadphase. /// @param inObjectLayerFilter Filter that is used to check if a character collides with a layer. /// @param inBodyFilter Filter that is used to check if a character collides with a body. /// @param inShapeFilter Filter that is used to check if a character collides with a subshape. /// @param inAllocator An allocator for temporary allocations. All memory will be freed by the time this function returns. /// @return Returns true if the switch succeeded. /// /// public bool SetShape(Shape shape, float maxPenetrationDepth, BroadPhaseLayerFilter broadPhaseLayerFilter, ObjectLayerFilter objectLayerFilter, BodyFilter bodyFilter, ShapeFilter shapeFilter, TempAllocator allocator) => Jolt.PInvoke.CharacterVirtual_SetShape(this, shape, maxPenetrationDepth, broadPhaseLayerFilter, objectLayerFilter, bodyFilter, shapeFilter, allocator); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:408 ///
/// void SetInnerBodyShape(const Shape *inShape) ///
///
/// /// /// Updates the shape of the inner rigid body. Should be called after a successful call to SetShape. /// /// public void SetInnerBodyShape(Shape shape) => Jolt.PInvoke.CharacterVirtual_SetInnerBodyShape(this, shape); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:513 ///
/// bool HasCollidedWith(const BodyID &inBody) const ///
///
/// /// /// Check if the character is currently in contact with or has collided with another body in the last /// operation (e.g. Update or WalkStairs) /// /// public bool HasCollidedWith(uint body) => Jolt.PInvoke.CharacterVirtual_HasCollidedWith(this, body); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:522 ///
/// bool HasCollidedWith(const CharacterID &inCharacterID) const ///
///
/// /// /// Check if the character is currently in contact with or has collided with another character in the last /// time step (e.g. Update or WalkStairs) /// /// public bool HasCollidedWith(CharacterID characterID) => Jolt.PInvoke.CharacterVirtual_HasCollidedWith_2(this, characterID); /// /// /// C++: /// Jolt/Physics/Character/CharacterVirtual.h:531 ///
/// bool HasCollidedWith(const CharacterVirtual *inCharacter) const ///
///
/// /// /// Check if the character is currently in contact with or has collided with another character in the last /// time step (e.g. Update or WalkStairs) /// /// public bool HasCollidedWith(CharacterVirtual character) => Jolt.PInvoke.CharacterVirtual_HasCollidedWith_3(this, character); public void AddRef() => Jolt.PInvoke.CharacterVirtual_AddRef(this); public void Release() => Jolt.PInvoke.CharacterVirtual_Release(this); public uint GetRefCount() => Jolt.PInvoke.CharacterVirtual_GetRefCount(this); public static implicit operator CharacterBase(CharacterVirtual value) => Jolt.PInvoke.CharacterVirtual_AsCharacterBase(value); public void Dispose() { if (IsNull()) return; Release(); } } }