OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: D_P_ on 28 Sep 2007, 04:42:53

Title: Turn an obect upsidedown?
Post by: D_P_ on 28 Sep 2007, 04:42:53
I want to take an object and rotate it until it's upside down. It's for a cutscene - anyone know how?
thanks in advance!
Title: Re: Turn an obect upsidedown?
Post by: Mandoble on 28 Sep 2007, 08:38:50
As long as the object accepts setVectorUp commands, uset setVectorUp. Check this (http://www.ofpec.com/forum/index.php?topic=29432.0).
Title: Re: Turn an obect upsidedown?
Post by: D_P_ on 28 Sep 2007, 22:00:18
Well the object is a grave cross...and I've tried setvectoup [0,0,0] <- I've tried adjusting the numbers but can't seem to turn it upside down! It turned 90...only half way to upside down :(
I must admit I have no clue what I'm doing with the setvectorup command...I just tweak the numbers until it looks right...but in this case I can't seem to get it :(

I checked the referance link above, that is a little beyond my cuurent scripting knowlege....and I can't speak sqf LOL   :whistle:

Any pointers?  :D
Title: Re: Turn an obect upsidedown?
Post by: Mandoble on 28 Sep 2007, 22:12:59
lets say your cross is named cross1:

Code: [Select]
cross1 setVectorUp [vectorUp cross1 select 0,vectorUp cross1 select 1,-(vectorUp cross1 select 2)]
Title: Re: Turn an obect upsidedown?
Post by: Spooner on 28 Sep 2007, 23:40:01
@D_P_
Code: [Select]
_object setVectorUp [0,0,0]
This doesn't use a valid vector, so it really should raise an error or, more likely for BIS, just have no effect. Without going into vector mathematics at great length (Google could be your friend here, but that rather depends on your mathematical background), a vector is a direction in 3D space with [x,y,z] being the magnitude of the vector in all three directions (in the game, this is [East, North, Up]). Thus, [0,0,0] points in no direction at all, [0,0,1] points up, [0,0,-1] points down, [1,0,0] points East, [-1,0,0] points West, [1, 1, 0] points NE, etc.

@Mandoble
Code: [Select]
cross1 setVectorUp [vectorUp cross1 select 0,vectorUp cross1 select 1,-(vectorUp cross1 select 2)]
Mirrors the object in the X-Y plane, rather than turning it upside down. Thus this would only turn the item upside-down correctly if its current up vector was [0,0,1] (object up is world up, so right way up) or [0,0,-1] (object up is world down, so upside-down). Wouldn't work if the object was on any kind of a slope or otherwise wasn't perfectly aligned to up/down axis...

Diagramatically:

[T = top of object, B = bottom of object, Z axis is up on the page]
T
  \
    \
      B

becomes

      B
    /
  /
T

To properly invert an object, so that its "head" is were its "feet" used to be, shouldn't it be?
Code: [Select]
cross1 setVectorUp [-(vectorUp cross1 select 0), -(vectorUp cross1 select 1), -(vectorUp cross1 select 2)]
Thus:

T
  \
    \
      B

becomes

B
  \
    \
      T

So, I hope that clears things up (or that people don't jump on me too hard if I've got it wrong ;P).
Title: Re: Turn an obect upsidedown?
Post by: Mandoble on 28 Sep 2007, 23:48:17
A cross placed in the map is already with a Z component close to 1 (not really 1 because crosses and many other objects placed in the map are aligned with the terrain).

EDIT:
Use Spooner command to avoid mirroring the cross in the X/Y axis.
Title: Re: Turn an obect upsidedown?
Post by: D_P_ on 29 Sep 2007, 07:25:34
Thanks for the info and answer, works great!  :clap: