Home   Help Search Login Register  

Author Topic: SOLVED : Created object x degrees from another object.  (Read 934 times)

0 Members and 1 Guest are viewing this topic.

Offline SniperUK

  • Members
  • *
  • I'm a llama!
Hi guys, this will be a relatively simple query to most and i have researched the boards regarding angles but came up with no luck.
The principle behind what i am trying to do is that i want an object to spawn on a very specific angle from another object.
Lets just say you have an object such as a house which is dynamically created during the mission, and you want a tent to spawn exactly 45 degrees north east of the house, how can this be done?

This would be all too easy if we knew the original starting positon as a static object however the mission will allow the user to select where they wish to place the original object ie. house and then select which angle from the house they wish to place the second object. ie. 10 metres north east on a 45 degree angle. Can this be done or am i being far too ambitious?

Thanks in advance.
« Last Edit: 24 Jul 2007, 08:51:45 by SniperUK »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Created object x degrees from another object.
« Reply #1 on: 24 Jul 2007, 04:07:42 »
Code: [Select]
_newpos = [(_poshouse select 0)+sin(45)*10,(_poshouse select 1)+cos(45)*10, 0]

Offline SniperUK

  • Members
  • *
  • I'm a llama!
Re: Created object x degrees from another object.
« Reply #2 on: 24 Jul 2007, 08:51:34 »
Worked fantastic first time. Thanks alot mandoble, twice in 2 days you have given me the perfect answer :D