Home   Help Search Login Register  

Author Topic: _camera camSetDir  (Read 1044 times)

0 Members and 1 Guest are viewing this topic.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
_camera camSetDir
« on: 31 Dec 2004, 20:09:13 »
Am I the only one to have problems with _camera camSetDir ?

Code: [Select]
_xAlexi = getPos Alexi select 0
_yAlexi = getPos Alexi select 1
_dirAlexi = getDir Alexi
_camera camSetPos [_xAlexi+0.25*sin(_dirAlexi),_yAlexi+0.25*cos(_dirAlexi),1.9]
_camera camSetDir _dirAlexi
Puts the camera in the correct place but it just points North.  

But:
Code: [Select]
_xAlexi = getPos Alexi select 0
_yAlexi = getPos Alexi select 1
_dirAlexi = getDir Alexi
_camera camSetPos [_xAlexi+0.25*sin(_dirAlexi),_yAlexi+0.25*cos(_dirAlexi),1.9]
_camera camSetTarget [_xAlexi+sin(_dirAlexi),_yAlexi+cos(_dirAlexi),1.9]
Works, even though it should have the same result.

All I am trying to do is to start a cut scene as viewed from Alexi's point of view.  It must have been done a million times.






Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:_camera camSetDir
« Reply #1 on: 31 Dec 2004, 20:28:41 »
I think if the camera is set at or near Alexi it can't really get a direction to Alexi, because it is already there.
So, possibly North is default.

Just guessing here, but normally camsetdir is supplied with a compass direction.....i.e.  270

Try a hint to find out what _dirAlexi is getting set to.



Planck
I know a little about a lot, and a lot about a little.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:_camera camSetDir
« Reply #2 on: 31 Dec 2004, 20:47:45 »
I did the hint.  It was 85 degrees. So
_camera camSetDir _dirAlexi

should be the equvalent of
_camera camSetDir 85

I even tried
_camera camSetDir (_dirAlexi + 90)

It still pointed north

The only thing I can think of is that  _camera camSetDir  will not accept a variable name as an argument.  But if that were the case I would have expected someone to have made a comment about it in the online Command reference.
« Last Edit: 31 Dec 2004, 20:48:21 by THobson »

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:_camera camSetDir
« Reply #3 on: 31 Dec 2004, 20:52:10 »
Check it by giving it 85 instead of _dirAlexi.


Planck
I know a little about a lot, and a lot about a little.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:_camera camSetDir
« Reply #4 on: 31 Dec 2004, 20:56:42 »
Sill points north.

I now wonder if _camera camSetDir  is completely broken

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:_camera camSetDir
« Reply #5 on: 31 Dec 2004, 21:10:10 »
I'll have to have a play with this.

Just a thought, but you did initialise your camera as....._camera and not as _cam.


Planck
I know a little about a lot, and a lot about a little.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:_camera camSetDir
« Reply #6 on: 31 Dec 2004, 21:12:20 »
Thanks.  Yes I did.  All the rest of the scene works, just not this bit.

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:_camera camSetDir
« Reply #7 on: 31 Dec 2004, 21:12:50 »
And don't forget to commit the change.....i.e.

_camera camSetDir _dirAlexi
_camera camCommit 0


Planck
« Last Edit: 31 Dec 2004, 21:13:36 by Planck »
I know a little about a lot, and a lot about a little.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:_camera camSetDir
« Reply #8 on: 01 Jan 2005, 18:57:53 »
I am doing that

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:_camera camSetDir
« Reply #9 on: 03 Jan 2005, 03:50:12 »
hmm... I can't ever recall using camsetdir, so I'm not sure if it works or not.

However bear in mind that there are many other camera related commands that simply don't seem to do anything (camsetbank anyone? :P).

You could get the same effect by using:

Quote
camera camsettarget [(getpos alexi select 0) + sin (getdir alexi) * 2000, (getpos alexi select 1) + cos (getdir alexi) * 2000, (getpos alexi select 2)]

Which will point the camera 2 klicks in the direction Alexi is facing...
« Last Edit: 03 Jan 2005, 03:57:33 by Sui »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:_camera camSetDir
« Reply #10 on: 03 Jan 2005, 13:08:19 »
Sui,

Thanks.  In my first post I did mention that I was getting the right result with a camSetTarget, I only used 1 meter though not 2000 :)

I was just a bit puzzled by why I could not get it to work and yet there were no comments to that effect in the online command ref.  I thought all bugs had been documented by now and so I must have been doing something wrong.