Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
make a turn limit
Old
dakota95
Senior Member
 
dakota95's Avatar
 
Status: Offline
Posts: 426
Join Date: Aug 2011
Location: like I would tell you. ;)
Default make a turn limit - 12-19-2011, 01:44 PM

How to I limit how much something can turn?

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.

any ideas????


<Insert_Signature_Here>
   
Reply With Quote
Old
TauTrumpsPi
Senior Member
 
TauTrumpsPi's Avatar
 
Status: Offline
Posts: 399
Join Date: Mar 2011
Location: The diamond layer
Default 12-19-2011, 05:55 PM

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
   
Reply With Quote
Old
dakota95
Senior Member
 
dakota95's Avatar
 
Status: Offline
Posts: 426
Join Date: Aug 2011
Location: like I would tell you. ;)
Default 12-20-2011, 10:47 AM

Quote:
Originally Posted by TauTrumpsPi View Post
In your turn method, have a variable go up as it turns.

If (variable) is below/above a certain point, stop the turning object
what if it is a gun on a moving airplane? Should I put a dummy where I want the limit? And what about a limit for sideways?


<Insert_Signature_Here>
   
Reply With Quote
Old
Joker899
Junior Member
 
Status: Offline
Posts: 5
Join Date: Dec 2011
Location: Canada
Default 12-20-2011, 09:38 PM

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
}
   
Reply With Quote
Old
Mr Kidnapper
Senior Member
 
Status: Offline
Posts: 442
Join Date: Feb 2011
Default 12-20-2011, 10:49 PM

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.
   
Reply With Quote
Old
dakota95
Senior Member
 
dakota95's Avatar
 
Status: Offline
Posts: 426
Join Date: Aug 2011
Location: like I would tell you. ;)
Default 12-21-2011, 09:25 PM

Quote:
Originally Posted by Mr Kidnapper View Post
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?


<Insert_Signature_Here>
   
Reply With Quote
Old
TauTrumpsPi
Senior Member
 
TauTrumpsPi's Avatar
 
Status: Offline
Posts: 399
Join Date: Mar 2011
Location: The diamond layer
Default 12-22-2011, 08:25 AM

Get along without variables!? How!?

Anyway, here's an example of how to stop a turn. It uses variables though, so you might need to learn those
Attached Files
File Type: a2w StopTurn.a2w (638.0 KB, 2 views)


--------------------------------------------------------------------------------------------------------------------------
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
   
Reply With Quote
Old
dakota95
Senior Member
 
dakota95's Avatar
 
Status: Offline
Posts: 426
Join Date: Aug 2011
Location: like I would tell you. ;)
Default 12-22-2011, 07:50 PM

Quote:
Originally Posted by TauTrumpsPi View Post
Get along without variables!? How!?

Anyway, here's an example of how to stop a turn. It uses variables though, so you might need to learn those
I'll check it out.


<Insert_Signature_Here>
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.