Home   Help Search Login Register  

Author Topic: Turn an obect upsidedown?  (Read 2288 times)

0 Members and 1 Guest are viewing this topic.

Offline D_P_

  • Members
  • *
  • YAY! I'm a lama again! ...oh wait.
    • ArmaAddons
Turn an obect upsidedown?
« 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!
just setpos & forgetpos!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Turn an obect upsidedown?
« Reply #1 on: 28 Sep 2007, 08:38:50 »
As long as the object accepts setVectorUp commands, uset setVectorUp. Check this.

Offline D_P_

  • Members
  • *
  • YAY! I'm a lama again! ...oh wait.
    • ArmaAddons
Re: Turn an obect upsidedown?
« Reply #2 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
just setpos & forgetpos!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Turn an obect upsidedown?
« Reply #3 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)]

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Turn an obect upsidedown?
« Reply #4 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).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Turn an obect upsidedown?
« Reply #5 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.
« Last Edit: 29 Sep 2007, 00:03:07 by Mandoble »

Offline D_P_

  • Members
  • *
  • YAY! I'm a lama again! ...oh wait.
    • ArmaAddons
Re: Turn an obect upsidedown?
« Reply #6 on: 29 Sep 2007, 07:25:34 »
Thanks for the info and answer, works great!  :clap:
just setpos & forgetpos!