i want to add force based on the triggers local position, but it always applies the force in world space, i dont see why this is happening
heres the snippets
if (isclimbing)
{
usegravity = false;
var climbdirection : Vector3 = (hor * right) + (ver * Vector3.up) + -ladderdirection.forward;
climbdirection *= climbspeed;
var climbvelocityChange = (climbdirection - velocity);
climbvelocityChange.x = Mathf.Clamp(climbvelocityChange.x, -maxVelocityChange, maxVelocityChange);
climbvelocityChange.y = Mathf.Clamp(climbvelocityChange.y, -maxVelocityChange, maxVelocityChange);
climbvelocityChange.z = Mathf.Clamp(climbvelocityChange.z, -maxVelocityChange, maxVelocityChange);
rigidbody.AddForce(climbvelocityChange, ForceMode.VelocityChange);
function OnTriggerEnter (other : Collider)
{
if(other.gameObject.tag == "ladder")
{
print("climbing ladder");
isclimbing = true;
ladderdirection = other.transform.localPosition;
}
}
function OnTriggerExit (other : Collider)
{
if(other.gameObject.tag == "ladder")
{
print("leaving ladder");
isclimbing = false;
}
}