
#include "vphysics2/iphysicsbody.h"
#include "vphysics2/iphysicsjoint.h"

[Handle:Sandbox.Physics.PhysicsJoint]
native class IPhysicsJoint as NativeEngine.IPhysicsJoint
{
	IPhysicsWorld GetWorld();

	IPhysicsBody GetBody1();
	IPhysicsBody GetBody2();

	void GetLocalFrameA( cref out Vector3 position, cref out Quaternion rotation );
	void GetLocalFrameB( cref out Vector3 position, cref out Quaternion rotation );
	void SetLocalFrameA( Vector3 position, Quaternion rotation );
	void SetLocalFrameB( Vector3 position, Quaternion rotation );

	void SetEnableCollision( bool bEnabled );
	bool IsCollisionEnabled();

	PhysicsJointType GetType();

	void SetLinearSpring( Vector3 vec );
	Vector3 GetLinearSpring();

	void SetAngularSpring( Vector3 vec );
	Vector3 GetAngularSpring();

	void SetAngularMotor( float targetVelocity, float maxTorque );

	void SetMinLength( float f );
	float GetMinLength();

	void SetMaxLength( float f );
	float GetMaxLength();

	void SetMinForce( float f );
	float GetMinForce();

	void SetMaxForce( float f );
	float GetMaxForce();

	void SetFriction( float f );

	void SetLimit( string name, Vector3 limit );
	void SetLimitEnabled( string name, bool state );

	float GetAngle();

	float GetLinearImpulse();
	float GetAngularImpulse();
	
	float GetMaxLinearImpulse();
	float GetMaxAngularImpulse();
	void SetMaxLinearImpulse( float flMaxLinearImpulse );
	void SetMaxAngularImpulse( float flMaxAngularImpulse );

	void SetMotorVelocity( Vector3 velocity, float maxTorque );
	void SetTargetRotation( Rotation rotation, float hertz, float damping );

	void Motor_SetLinearVelocity( Vector3 velocity );
	void Motor_SetAngularVelocity( Vector3 velocity );
	void Motor_SetMaxVelocityForce( float maxForce );
	void Motor_SetMaxVelocityTorque( float maxTorque );
	void Motor_SetLinearHertz( float hertz );
	void Motor_SetLinearDampingRatio( float damping );
	void Motor_SetAngularHertz( float hertz );
	void Motor_SetAngularDampingRatio( float damping );
	void Motor_SetMaxSpringForce( float maxForce );
	void Motor_SetMaxSpringTorque( float maxTorque );

	Vector3 Motor_GetLinearVelocity();
	Vector3 Motor_GetAngularVelocity();
	float Motor_GetMaxVelocityForce();
	float Motor_GetMaxVelocityTorque();
	float Motor_GetLinearHertz();
	float Motor_GetLinearDampingRatio();
	float Motor_GetAngularHertz();
	float Motor_GetAngularDampingRatio();
	float Motor_GetMaxSpringForce();
	float Motor_GetMaxSpringTorque();
}

managed static class Sandbox.Physics.PhysicsEngine
{
	static void OnPhysicsJointBreak( IPhysicsJoint joint );
	static void OnActive( IPhysicsBody body, Transform transform, Vector3 velocity, Vector3 linearVelocity );
}
