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 / Limiting torso rotation

Author
Message
Jaeg
18
Years of Service
User Offline
Joined: 16th Mar 2006
Location: Indiana
Posted: 23rd Jan 2011 19:32
I've figured out how to rotate my model at its torso but I can't figure out how to limit it's rotation. If the rotation was between 0 and 80 it wouldn't be a problem you could just use
and then add some code to wrap the value within that. But my problem is that the rotation is from 313 wrapped around to 0 then to 80. If that didn't make sense then I mean this:
313 - 360 and 0 - 80.
I had tried subtracting 360 from 313 but that doesn't work.

With the given code it should get to 80 one way and stop or got to 313 and stop. I haven't worked out the code to adjust the limb so that it doesn't freeze in place yet.

But the code never executes the rotate limb command. The limb's x rotate stays at 0.

I have a feeling I'm totally missing the boat.

Go ahead. Walk into Mordor.

Ball State University - Biology Major
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 23rd Jan 2011 19:38 Edited at: 23rd Jan 2011 19:38
What about if you put:

if rotx<-47 then xxxx
if rotx>47 then xxxx



Cheers.

I'm not a grumpy grandpa
Jaeg
18
Years of Service
User Offline
Joined: 16th Mar 2006
Location: Indiana
Posted: 23rd Jan 2011 19:46
No go.. Heres the entire source if it helps. There isn't a lot going on. Any model with an FPSC skeleton should work.


Go ahead. Walk into Mordor.

Ball State University - Biology Major
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 23rd Jan 2011 20:04
So you are trying to control your object with the mouse ?

Have you tried instead of:

rotate limb 1,24, wrapvalue(mousex()),0,0

with:

rotate limb 1,24, wrapvalue(mousemovex()),0,0


Cheers.

I'm not a grumpy grandpa
Jaeg
18
Years of Service
User Offline
Joined: 16th Mar 2006
Location: Indiana
Posted: 23rd Jan 2011 20:25
I had forgotten about that command! That line of code really doesn't work it has to be changed to this


Which is a lot smoother than using mousex() and will probably help me limit the angle better. Thanks!

Go ahead. Walk into Mordor.

Ball State University - Biology Major
Jaeg
18
Years of Service
User Offline
Joined: 16th Mar 2006
Location: Indiana
Posted: 23rd Jan 2011 20:44
My topic is already on top of the list so if I bump it's not very far.
I got the code working awesomely so I'm going to share it for anyone who needs it. This will work one any model with an FPSC skeleton for sure and if you need a different limb change 24 to whatever you need.


The first part of the code is to limit movex which stores the mousemovex value. If you don't do this and suddenly move you mouse really far from it's starting position your models torso will jump around.

Go ahead. Walk into Mordor.

Ball State University - Biology Major

Login to post a reply

Server time is: 2024-09-29 00:22:50
Your offset time is: 2024-09-29 00:22:50