Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Limb Rotate Help

Author
Message
Butter fingers
18
Years of Service
User Offline
Joined: 20th Mar 2006
Location: Mecca
Posted: 29th Aug 2008 13:39
Hey.

(reposting here because it\'s been swiftly ignored in the DBpro board)

Im currently making a TPS, and I\'m trying to rotate the limbs within a characters skeleton so that they point their torso towards a target. I want to do this without using enhanced anim, using DBP native commands.

Initially they were rotating all over the place because I didn\'t realise that the values you pass to \"rotate Limb\" are offset values from the current angle, not new angles...
I\'ve done this function to rotate the limb:



Quote: "function rotatealimb(obj,limb)

position object aimaid,limb position x(obj,limb),limb position y(obj,limb),limb position z(obj,limb)
point object aimaid,AI Get Entity Target X(obj),object position y (aimaid),AI Get Entity Target Z(obj)
aimangle=wrapvalue(object angle y(aimaid))
limbangle=wrapvalue(limb angle y(obj,limb))
biggest=max(aimangle,limbangle)
if biggest=aimangle
rotate limb obj,limb,0,aimangle-limbangle,0
else
rotate limb obj,limb,0,(limbangle-aimangle)*-1,0
endfunction"




just a heads up aimaid is a hidden object thats just useful for working out angles.
\"max\" is a styx command (i think) that returns the highest of the 2 given values.

THing is this function still doesn\'t work!
Any help would be much appreciated!

I realise that at the moment there are no limits to the rotation (so the character can point their torso 180 degress from their legs, but for now thats not an issue, once I can actually get the rotation working propperly, I can start to limit it!

Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 30th Aug 2008 01:08
I haven't tested it from any position but here's the idea

Butter fingers
18
Years of Service
User Offline
Joined: 20th Mar 2006
Location: Mecca
Posted: 1st Sep 2008 01:41
Thank you very much.
Code worked a treat, and with a bit of fiddling, it works wonderfully!
Has opened the door to doing things like tank turrets without needing 2 separate meshes for tank and turret.

Cheers!

Login to post a reply

Server time is: 2024-11-25 18:41:48
Your offset time is: 2024-11-25 18:41:48