Jump to content

Recommended Posts

Hello, i'm trying to use the addaction command to a floating object... There is flooring right below the object but it seems every time i use the "Enter" command when playing the mission, it just teleports me to the actual ground and not the flooring that i have lying directly below the "door"/entrance... Any help is greatly appreciated... Thanks in advanced!

Share this post


Link to post
Share on other sites

You'll get help faster if you share information. 

 

You are probably using setPos, when you need to use setPosATL.

  • Like 1

Share this post


Link to post
Share on other sites
11 minutes ago, Harzach said:

You'll get help faster if you share information. 

 

You are probably using setPos, when you need to use setPosATL.

Yeah sorry about that, i had completely forgot to copy and paste what i had down but indeed it was setPos... Is that all i need to do? is just put ATL at the end of this? 

This was my scripting "this addaction ["text", {player setPos (getPos obj)}]"

Share this post


Link to post
Share on other sites
this addAction ["text", {player setPos [getPos obj select 0, (getPos obj select 1) + 5, getPos obj select 2]; // 5 m above obj}];

You can also use setPosATL as @Harzach said.

Share this post


Link to post
Share on other sites

Well, more like 

{player setPosATL (getPosATL obj)}

But then you're still just placing the player at the position of the object's center. Depending on what the object is, it might work fine, but more likely you'll need to specify the altitude explicitly. The easiest thing to do is place a unit exactly where you want them to appear then log its position (right click on unit, Log Position to Clipboard). Then you could just paste the info into your code:

{player setPosATL <paste>}

which would end up looking something like:

{player setPosATL [4357.1,3892.42,31.4476]}

 

Share this post


Link to post
Share on other sites

Depending on the object, you may want to go higher, say if wooden platform. Not tested but won't it put you in middle or something?

  • Thanks 1

Share this post


Link to post
Share on other sites
10 minutes ago, HazJ said:

Depending on the object, you may want to go higher, say if wooden platform. Not tested but won't it put you in middle or something?

 

Is this in reference to logged position? That method is WYSIWYG (less azimuth, but then we can always setDir as well), so if you place a unit standing on a platform, that's where they will appear when setPos'd.

  • Thanks 1

Share this post


Link to post
Share on other sites
4 hours ago, HazJ said:

Depending on the object, you may want to go higher, say if wooden platform. Not tested but won't it put you in middle or something?

 

4 hours ago, Harzach said:

 

Is this in reference to logged position? That method is WYSIWYG (less azimuth, but then we can always setDir as well), so if you place a unit standing on a platform, that's where they will appear when setPos'd.

Yeah, thank you both for the info... I do have to specify the altitude at its puts me in the center of the object, and the object is quite big so it became a problem as i was becoming trapped... Again thanks for the help much appreciated..

Share this post


Link to post
Share on other sites

You can try to find your object's floor (if any), starting form to center of the object, and searching for:
 

_nearestFloor = lineIntersectsSurfaces [ getPosWorld yourObjet, getPosWorld yourObject vectorAdd [0, 0, -50], objnull, objNull, true, 1, "GEOM", "NONE" ] select 0 select 0;

teleport using getposASL in this case. Add a little offset:

- on getposworld yourObject if your don't want something "centered" (sometimes objects have a huge bounding box)

- on the result itself if you want to be a little higher.

 

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

×