Home   Help Search Login Register  

Author Topic: Comparing Arrays  (Read 751 times)

0 Members and 2 Guests are viewing this topic.

toadeater

  • Guest
Comparing Arrays
« on: 24 Nov 2002, 06:13:40 »
What's the best syntax to use to find out if an object has moved? I tried:

? (getpos _oldpos) != (getpos _newpos)

and it gives an error about arrays/objects. So do I have to check x and y seperately or is there a more elegant way? I can't figure out how to compare arrays against each other I guess.   :'(

Offline Sentinel

  • Contributing Member
  • **
  • World is tough and I'm tougher!!
Re:Comparing Arrays
« Reply #1 on: 24 Nov 2002, 19:29:05 »
If you want to know distance between two objects use this syntax:

(object1 distance object2)

It gives distance in meters.


You can also compare x, y or z co-ordinates with select command:

x = getpos object select 0
y = getpos object select 1
z = getpos object select 2

So position array is [x,y,z]

« Last Edit: 24 Nov 2002, 19:29:43 by Sentinel »

toadeater

  • Guest
Re:Comparing Arrays
« Reply #2 on: 25 Nov 2002, 07:14:15 »
Ok, I guess I'll have to use select 0, etc.