Spunned 10 Posted August 14, 2013 (edited) hiya people :) you've always been helpful, so im sure ya'll can figure this one out. so, i use the code below to spawn objects ingame that are not directly accessable through the editor, however, with this piece of code, im unable to do anything about the rotation of the object around the y axis (normal 360 rotation) and the rotation on the z axis (if the object is placed like a guard tower that doesn't conform to the terrain, if like a normal object that rotates according to the slope it's placed on). any way of incorporating into the code these rotational degrees? wokka= "Land_Slum_House01_F" createVehicle position this; deleteVehicle this; TL;DR wokka= "Land_i_House_Big_01_V1_F" createVehicle position this; wokka setDir direction this; deleteVehicle this; Edited August 14, 2013 by Spunned Problem solved Share this post Link to post Share on other sites
Varanon 892 Posted August 14, 2013 You might want to look into the commands setDir, setVectorUp and/or setVectorDirAndUp and similar. SetDir is the simplest, but only allows for rotation around the Z axis. Placing according to terrain is going to be a tough one, I would guess. You basically would need to set the up vector to the current terrain normal... You might want to try to set the setUpVector the new object to the up vector of the placeholder object (vectorUp will retrieve the up vector) So, in your example: [color=#000000][color=#0000BB]wokka[/color][color=#007700]= [/color][color=#DD0000]"Land_Slum_House01_F" [/color][color=#0000BB]createVehicle position this[/color][color=#007700]; [/color][color=#0000BB]wokka setVecttorDirAndUp [vectorDir this, vectorUp this]; deleteVehicle this[/color][color=#007700]; [/color][/color] Didn't test this, though, it might not work (you're probably using a game logic ?) Share this post Link to post Share on other sites
Spunned 10 Posted August 14, 2013 thanks for your help :) here's what i found out while trying out your code: picture of what im talking about http://steamcommunity.com/sharedfiles/filedetails/?id=169459765 the house on the right is my original code. the spawned object is placed with an angle perpendicular to the terrain (bad for certain stuff like houses) the code for that is here: wokka= "Land_Slum_House01_F" createVehicle position this; deleteVehicle this; however the house on the left is this code: wokka= "Land_i_House_Big_01_V1_F" createVehicle position this; deleteVehicle this; wokka setDir 180; turns out all you need is to use the setDir and simply set one value. the rest of the values are automatically set to 0 and thus the z index will be 0. lastly, any way of binding the setDir degrees to whatever degree is used for the initial object? that way i dont have to edit the code every time i wanna turn something? ps: i use the "helipad invisible" in empty faction for the initial object :) Share this post Link to post Share on other sites
Varanon 892 Posted August 14, 2013 lastly, any way of binding the setDir degrees to whatever degree is used for the initial object? that way i dont have to edit the code every time i wanna turn something? There's the direction command that will return the direction an object is facing. So move the setDir in front of the deleteVehicle this, and replace 180 with (direction this), and you should be set. Edit: By the way, if you check the links I posted, like the setDir command, the pages usually link their counterpart in the "see also" part at the bottom of the page. This comes in handy in cases like this Share this post Link to post Share on other sites
Spunned 10 Posted August 14, 2013 There's the direction command that will return the direction an object is facing. So move the setDir in front of the deleteVehicle this, and replace 180 with (direction this), and you should be set.Edit: By the way, if you check the links I posted, like the setDir command, the pages usually link their counterpart in the "see also" part at the bottom of the page. This comes in handy in cases like this awesome, it works. just for everyone else reading this thread, here's the code: wokka= "Land_i_House_Big_01_V1_F" createVehicle position this; wokka setDir direction this; deleteVehicle this; thank you for your help :) Share this post Link to post Share on other sites