for instance: that B-17 that mr kidnapper made, I am trying to make a game out of it. Only problem, when I turn the guns, they go right through the fuselage(body). What I need is a way to limit how far the guns can turn.
In your turn method, have a variable go up as it turns.
If (variable) is below/above a certain point, stop the turning object
--------------------------------------------------------------------------------------------------------------------------
I have plenty of common sense. I just choose to ignore it.
-Calvin and Hobbes
Wondering about my Avatar?
http://en.wikipedia.org/wiki/Tardigrade
Wondering about my username?
http://www.youtube.com/watch?v=jG7vhMMXagQ
Have a variable for each direction that it turns. Have an if/else that says
if [variable >= (value)]
do nothing
Else
Do together {
turn
increment variable by 1
}
You don't need a dummy object. What you need is a variable for each axis that is intended to rotate, so at most 3 axes. Set each of these to 0. Now, how fast is your rate of rotation? Say it's 5º per second. Let's make the rotation method
"If hAxis < 45
then gun turn right 5/360 rotations
hAxis = hAxis + 5
else do nothing
if hAxis >-45
then gun turn left 5/360 rotations
hAxis = hAxis - 5
else do nothing"
Turns in either direction 45º at most.
You don't need a dummy object. What you need is a variable for each axis that is intended to rotate, so at most 3 axes. Set each of these to 0. Now, how fast is your rate of rotation? Say it's 5º per second. Let's make the rotation method
"If hAxis < 45
then gun turn right 5/360 rotations
hAxis = hAxis + 5
else do nothing
if hAxis >-45
then gun turn left 5/360 rotations
hAxis = hAxis - 5
else do nothing"
Turns in either direction 45º at most.
Gosh. Guess I should learn how to use variables at some point. I just tried to get along without 'em. Can you give me a step-by-step and write out exactly what I need to do, where to find the correct stuff, and anything else I might need to know?
Anyway, here's an example of how to stop a turn. It uses variables though, so you might need to learn those
--------------------------------------------------------------------------------------------------------------------------
I have plenty of common sense. I just choose to ignore it.
-Calvin and Hobbes
Wondering about my Avatar?
http://en.wikipedia.org/wiki/Tardigrade
Wondering about my username?
http://www.youtube.com/watch?v=jG7vhMMXagQ