130 lines
3.4 KiB
C#
130 lines
3.4 KiB
C#
namespace XCEngine
|
|
{
|
|
public sealed class Rigidbody : Component
|
|
{
|
|
internal Rigidbody(ulong gameObjectUUID)
|
|
: base(gameObjectUUID)
|
|
{
|
|
}
|
|
|
|
public PhysicsBodyType BodyType
|
|
{
|
|
get => (PhysicsBodyType)InternalCalls.Rigidbody_GetBodyType(GameObjectUUID);
|
|
set => InternalCalls.Rigidbody_SetBodyType(GameObjectUUID, (int)value);
|
|
}
|
|
|
|
public PhysicsBodyType bodyType
|
|
{
|
|
get => BodyType;
|
|
set => BodyType = value;
|
|
}
|
|
|
|
public float Mass
|
|
{
|
|
get => InternalCalls.Rigidbody_GetMass(GameObjectUUID);
|
|
set => InternalCalls.Rigidbody_SetMass(GameObjectUUID, value);
|
|
}
|
|
|
|
public float mass
|
|
{
|
|
get => Mass;
|
|
set => Mass = value;
|
|
}
|
|
|
|
public float LinearDamping
|
|
{
|
|
get => InternalCalls.Rigidbody_GetLinearDamping(GameObjectUUID);
|
|
set => InternalCalls.Rigidbody_SetLinearDamping(GameObjectUUID, value);
|
|
}
|
|
|
|
public float linearDamping
|
|
{
|
|
get => LinearDamping;
|
|
set => LinearDamping = value;
|
|
}
|
|
|
|
public float AngularDamping
|
|
{
|
|
get => InternalCalls.Rigidbody_GetAngularDamping(GameObjectUUID);
|
|
set => InternalCalls.Rigidbody_SetAngularDamping(GameObjectUUID, value);
|
|
}
|
|
|
|
public float angularDamping
|
|
{
|
|
get => AngularDamping;
|
|
set => AngularDamping = value;
|
|
}
|
|
|
|
public Vector3 LinearVelocity
|
|
{
|
|
get
|
|
{
|
|
InternalCalls.Rigidbody_GetLinearVelocity(GameObjectUUID, out Vector3 velocity);
|
|
return velocity;
|
|
}
|
|
set => InternalCalls.Rigidbody_SetLinearVelocity(GameObjectUUID, ref value);
|
|
}
|
|
|
|
public Vector3 linearVelocity
|
|
{
|
|
get => LinearVelocity;
|
|
set => LinearVelocity = value;
|
|
}
|
|
|
|
public Vector3 AngularVelocity
|
|
{
|
|
get
|
|
{
|
|
InternalCalls.Rigidbody_GetAngularVelocity(GameObjectUUID, out Vector3 velocity);
|
|
return velocity;
|
|
}
|
|
set => InternalCalls.Rigidbody_SetAngularVelocity(GameObjectUUID, ref value);
|
|
}
|
|
|
|
public Vector3 angularVelocity
|
|
{
|
|
get => AngularVelocity;
|
|
set => AngularVelocity = value;
|
|
}
|
|
|
|
public bool UseGravity
|
|
{
|
|
get => InternalCalls.Rigidbody_GetUseGravity(GameObjectUUID);
|
|
set => InternalCalls.Rigidbody_SetUseGravity(GameObjectUUID, value);
|
|
}
|
|
|
|
public bool useGravity
|
|
{
|
|
get => UseGravity;
|
|
set => UseGravity = value;
|
|
}
|
|
|
|
public bool EnableCCD
|
|
{
|
|
get => InternalCalls.Rigidbody_GetEnableCCD(GameObjectUUID);
|
|
set => InternalCalls.Rigidbody_SetEnableCCD(GameObjectUUID, value);
|
|
}
|
|
|
|
public bool enableCCD
|
|
{
|
|
get => EnableCCD;
|
|
set => EnableCCD = value;
|
|
}
|
|
|
|
public void AddForce(Vector3 force)
|
|
{
|
|
AddForce(force, ForceMode.Force);
|
|
}
|
|
|
|
public void AddForce(Vector3 force, ForceMode mode)
|
|
{
|
|
InternalCalls.Rigidbody_AddForce(GameObjectUUID, ref force, (int)mode);
|
|
}
|
|
|
|
public void ClearForces()
|
|
{
|
|
InternalCalls.Rigidbody_ClearForces(GameObjectUUID);
|
|
}
|
|
}
|
|
}
|