#skyrbunny math

1 messages · Page 1 of 1 (latest)

slate valve
#

hello

turbid canyon
#

yes alright so

#

Basically I'm casting a ray forward and down to find foot placement, but I want the foot placement to be further if the gameobject is moving faster. and behind if it's moving backwards

#

A is always coplanar with the Z axis in local space, and then is rotated to match transform.forward

slate valve
#

is the running figure's center at waist height or at floor height?

#

center of mass or point on the ground?

turbid canyon
#

so I want to figure out how far D goes in the direction of transform.forward and then move A so that it does out further or less far in the Z axis

turbid canyon
slate valve
#

ok, so how about this:
hips = point on ground + z * hipHeight;
maybeNextFoot = pointOnGround + forward * speed;
ray = ( maybeNextFoot - hips ).normalize;
then raycast to find intersection with ground

#

and if the raycast distance is too far you know they're stepping off a cliff.

#

now if speed is negative it will cast the ray backwards

#

does that work for you?

turbid canyon
#

im currently calculating the angle like this:

return (
                (hip.transform.right * (footForwardAngle.x)) +
                (hip.transform.up * (footForwardAngle.y * transformedAngle.y))) +
                (hip.transform.forward * (footForwardAngle.z)
            );

and footForwardAngle is the predefined angle from the hip joint to the ground where the foot will be placed if the speed is one.

However, calculating the goal point first based on the direction we are moving, and then casting a ray between them, is not a bad idea. Let me ttry that

slate valve
#

well... you're not calculating an angle. let's use the correct terminology.

#

tranformedAngle.y is what?

turbid canyon
#

Ok, I think I've got it now?

slate valve
#

nice!