direction and position functions.

View previous topic View next topic Go down

direction and position functions.

Post by Sting Auer on Sun Sep 19, 2010 7:25 pm

I have tried to pick the script out of the landmarker model, but i just cant figure out what is what.

i would like to know which functions to use that will measure the rotation of a vehicle so that i can make some hovercrafts. I cant figure out how to do it on my own, so i am asking for help.

I am looking for the functions for ROTATION, not coordinates in the world.
avatar
Sting Auer
Hover
Hover

Posts : 170
Join date : 2010-09-19
Location : Aw crap i think I'm lost.

View user profile

Back to top Go down

Re: direction and position functions.

Post by T-Bouw on Mon Sep 20, 2010 8:35 am

The functions you're looking for are: _ax(), _ay() & _az().
Give one central chip in your model a name and put that name inbetween the brackets.

However, the output is in radians. If you want it in degrees use: _todeg().
Put the whole function that outputs radians inbetween the brackets again.
avatar
T-Bouw
Car
Car

Posts : 22
Join date : 2010-07-22
Age : 34
Location : The Netherlands

View user profile

Back to top Go down

Re: direction and position functions.

Post by Sting Auer on Mon Sep 20, 2010 11:03 am

ok thank you T-Bouw.-hugs-

EDIT: ok it isnt working. i put a jet on each side of the core, made values for the jets, and i think i typed in the script correctly, but it isn't working. any idea what i am doing wrong? here is the code for the test.

Code:


// [RCD]
Val
{
   BJET(default=0, min=-500, max=1000, step=1000)
   FJET(default=0, min=-500, max=1000, step=1000)
   LJET(default=0, min=-500, max=1000, step=1000)
   RJET(default=0, min=-500, max=1000, step=1000)
}
Key
{
}
Body
{
   Core(name=CORE) {
      N:Jet(power=FJET) { }
      S:Jet(power=BJET) { }
      W:Jet(power=LJET) { }
      E:Jet(power=RJET) { }
   }
}
Script
{if _TODEG(_AX(core))=-10{
FJET=(1000)}}




am i doing something wrong?
avatar
Sting Auer
Hover
Hover

Posts : 170
Join date : 2010-09-19
Location : Aw crap i think I'm lost.

View user profile

Back to top Go down

Re: direction and position functions.

Post by bwansy on Mon Sep 20, 2010 9:54 pm

From what I can see, the jet would only fire when _AX() is exactly -10 degrees. The problem is that angles in RC are not integers, but rather, decimals. The jet simply wouldn't fire even if _AX() is -10.00000001 or -9.9999999 degrees. The chance of _AX() = -10 (integer) is very very slim. It's almost like trying to split an arrow (Robin Hood style) by firing an arrow from Mars.

There are 2 ways to make it work. If you really want the jets to fire when _AX() equals, or close to -10 degrees, you can use _ROUND(_TODEG(AX())) = -10, which gives you a 1 degree range. But if it is an auto-balance script, you'd probably want to fire the jet when _AX() < -10 degrees.

_________________
A.K.A. Bernard

bwansy
Admin

Posts : 170
Join date : 2010-07-15

View user profile http://rigidchips.forum-motion.com

Back to top Go down

Re: direction and position functions.

Post by Sting Auer on Tue Sep 21, 2010 10:42 am

OK thank you Bwansy. Now i have it working.

and thanks T_bouw for the original script!


you will soon see my first hovering creation on the forums.
avatar
Sting Auer
Hover
Hover

Posts : 170
Join date : 2010-09-19
Location : Aw crap i think I'm lost.

View user profile

Back to top Go down

Re: direction and position functions.

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum