Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
iNeo

Createvehicle pos player = inaccurate

Recommended Posts

I just noticed that when I use the createVehicle command and set the object's position to a player, the created object is created at a position at a random number of meters (max ca 10) away from the player.

However, setting its position using a marker (getmarkerpos) instead of a player (getpos) is accurate, so an easy work-around is to have a marker following the player(s) in real-time, and setting the created vehicle's position to the marker.

<span style='font-size:7.1pt;line-height:100%'>Just thought I'd mention this (didn't find anything about it using the search).</span>

Share this post


Link to post
Share on other sites

Does this happen if you use the position of an AI unit? I think it might have been done to avoid collision with a player unit that may look messy (just a guess)

RED

Share this post


Link to post
Share on other sites

Hi iNeo,

The problem is not only with player.

It seems that the createVehicle command will NOT create anything on an already occupied location. It will always put the new created vehicle a few meters aside. It works with markers because a marker is not occupying any space.

The workaround that I use is just creating the object at [0, 0, 0] location and move it afterwards.

Cheers

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (RED @ 04 May 2003,15:15)</td></tr><tr><td id="QUOTE">Does this happen if you use the position of an AI unit? I think it might have been done to avoid collision with a player unit that may look messy (just a guess)<span id='postcolor'>

No, I used it on myself.

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (AliMag @ 04 May 2003,15:18)</td></tr><tr><td id="QUOTE">It seems that the createVehicle command will NOT create anything on an already occupied location. It will always put the new created vehicle a few meters aside. It works with markers because a marker is not occupying any space.

The workaround that I use is just creating the object at [0, 0, 0] location and move it afterwards.<span id='postcolor'>

Interesting. So to place an object 1 meter infront of the player...

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_object = "objectType" createVehicle getpos player<span id='postcolor'>

What should I add after player (to place the object 1 meter ahead of him)?

Thanks for the replies. smile.gif

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_x = getpos player select 0 + ((sin (getdir spieler))*1)

_y = getpos player select 1 + ((cos (getdir spieler))*1)

_z = getpos player select 2

_object setpos [_x,_y,_Z]

<span id='postcolor'>

Something like that will work.

RED

Share this post


Link to post
Share on other sites

Thanks, I will try it tonight icon7.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×