Facing towards movement direction
ShiVa assumes that your character faces in the -Z direction.
Just place this simple script snip in the model’s AI in .onEnterFrame ( ):
local o = this.getObject ( ) -- This line sets variable o as the object pointer
-- ...
if ( navigation.getSpeed (o) > 0 ) -- If the object is moving, then do the following...
then
local vx, vy, vz = navigation.getVelocity ( o ) -- Get the object's velocity per xyz.
local x, y, z = object.getTranslation ( o, object.kGlobalSpace ) -- Get the object's postion in xyz.
object.lookAtWithUp ( o, x + vx, y + vy, z + vz, 0, 1, 0, object.kGlobalSpace, .05 ) -- Look in the direction it's moving.
end
-- ...