//
// Generated by Brutal.Jolt.Generate; do not edit by hand.
#nullable enable
using System.Runtime.CompilerServices;
using Brutal.Interop;
using Brutal.Numerics;
namespace Brutal.JoltApi
{
///
///
/// Encapsulates a collision contact between a character and another rigid body / character
///
///
/// C++:
/// Jolt/Physics/Character/CharacterVirtual.h:129
///
/// class CharacterContact : public CharacterContactKey
///
///
[StructLayout(LayoutKind.Explicit, Size = 128)]
public partial struct CharacterContact
{
[FieldOffset(0)]
public uint BodyB;
[FieldOffset(4)]
public uint CharacterIDB;
[FieldOffset(8)]
public uint SubShapeIDB;
///
///
/// Position where the character makes contact
///
///
/// C++:
/// Jolt/Physics/Character/CharacterVirtual.h:136
///
/// RVec3 mPosition
///
///
[FieldOffset(16)]
public float3 Position;
///
///
/// Velocity of the contact point
///
///
/// C++:
/// Jolt/Physics/Character/CharacterVirtual.h:137
///
/// Vec3 mLinearVelocity
///
///
[FieldOffset(32)]
public float3 LinearVelocity;
///
///
/// Contact normal, pointing towards the character
///
///
/// C++:
/// Jolt/Physics/Character/CharacterVirtual.h:138
///
/// Vec3 mContactNormal
///
///
[FieldOffset(48)]
public float3 ContactNormal;
///
///
/// Surface normal of the contact. Has been flipped if the contact is back facing (mIsBackFacingContact) and
/// is equal to the contact normal if the contact normal is pointing up more.
///
///
/// C++:
/// Jolt/Physics/Character/CharacterVirtual.h:139
///
/// Vec3 mSurfaceNormal
///
///
[FieldOffset(64)]
public float3 SurfaceNormal;
///
///
/// Distance to the contact <= 0 means that it is an actual contact, > 0 means predictive
///
///
/// C++:
/// Jolt/Physics/Character/CharacterVirtual.h:140
///
/// float mDistance
///
///
[FieldOffset(80)]
public float Distance;
///
///
/// Fraction along the path where this contact takes place
///
///
/// C++:
/// Jolt/Physics/Character/CharacterVirtual.h:141
///
/// float mFraction
///
///
[FieldOffset(84)]
public float Fraction;
///
///
/// Motion type of B, used to determine the priority of the contact
///
///
/// C++:
/// Jolt/Physics/Character/CharacterVirtual.h:142
///
/// EMotionType mMotionTypeB
///
///
[FieldOffset(88)]
public MotionType MotionTypeB;
///
///
/// If B is a sensor
///
///
/// C++:
/// Jolt/Physics/Character/CharacterVirtual.h:143
///
/// bool mIsSensorB
///
///
[FieldOffset(89)]
public Brutal.Bool8 IsSensorB;
///
///
/// 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:144
///
/// const CharacterVirtual * mCharacterB = nullptr
///
///
[FieldOffset(96)]
public CharacterVirtual CharacterB;
///
///
/// User data of B
///
///
/// C++:
/// Jolt/Physics/Character/CharacterVirtual.h:145
///
/// uint64 mUserData
///
///
[FieldOffset(104)]
public ulong UserData;
///
///
/// Material of B
///
///
/// C++:
/// Jolt/Physics/Character/CharacterVirtual.h:146
///
/// const PhysicsMaterial * mMaterial
///
///
[FieldOffset(112)]
public PhysicsMaterial Material;
///
///
/// 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:147
///
/// bool mHadCollision = false
///
///
[FieldOffset(120)]
public Brutal.Bool8 HadCollision;
///
///
/// If the contact validate callback chose to discard this contact or when the body is a sensor
///
///
/// C++:
/// Jolt/Physics/Character/CharacterVirtual.h:148
///
/// bool mWasDiscarded = false
///
///
[FieldOffset(121)]
public Brutal.Bool8 WasDiscarded;
///
///
/// When true, the velocity of the contact point can push the character
///
///
/// C++:
/// Jolt/Physics/Character/CharacterVirtual.h:149
///
/// bool mCanPushCharacter = true
///
///
[FieldOffset(122)]
public Brutal.Bool8 CanPushCharacter;
///
///
/// If this contact came from a back facing triangle / collision shape
///
///
/// C++:
/// Jolt/Physics/Character/CharacterVirtual.h:150
///
/// bool mIsBackFacingContact = false
///
///
[FieldOffset(123)]
public Brutal.Bool8 IsBackFacingContact;
///
///
/// Saving / restoring state for replay
///
///
/// C++:
/// Jolt/Physics/Character/CharacterVirtual.h:133
///
/// void SaveState(StateRecorder &inStream) const
///
///
public readonly void SaveState(StateRecorder stream) =>
Jolt.PInvoke.CharacterContact_SaveState(ref Unsafe.AsRef(in this), stream);
///
///
/// C++:
/// Jolt/Physics/Character/CharacterVirtual.h:134
///
/// void RestoreState(StateRecorder &inStream)
///
///
public void RestoreState(StateRecorder stream) => Jolt.PInvoke.CharacterContact_RestoreState(ref this, stream);
}
}