Cobal Posted April 8, 2017 Share Posted April 8, 2017 (edited) I would like to spawn an actor about 70 units behind the player and almost instantly kill it.Everything is working fine except for the fact that I can't figure out how to find the coords of a point that is currently behind the players heading. I can get the players angle, I can get the players location. Moveto allows only for absolute offset. ANyone have a clue how I can do this? [edit]Oh goody my fat fingers made my usual typo with "the" in the title. Title doesn't seem to be editable :( [/edit] Edited April 8, 2017 by Cobal Link to comment Share on other sites More sharing options...
Athelbras Posted April 9, 2017 Share Posted April 9, 2017 Something like this ... float fAnglefloat fSinfloat fCosfloat fHeight fAngle = Game.GetPlayer().GetAngleZ() + 180.0fSin = Math.sin(fAngle)fCos = Math.cos(fAngle)fHeight = Game.GetPlayer().GetPositionZ() pMyNPC.MoveTo(Game.GetPlayer(), 70.0 * fSin, 70.0 * fCos, fHeight, False) Note that the correct height of "ground level" at 70 units behind the player's character is not handled by the code snippet above. Might actually be higher or lower than the player character's, depending on the nature of the terrain. So that is something for you to resolve in your own final scripting. Link to comment Share on other sites More sharing options...
caleb68 Posted April 9, 2017 Share Posted April 9, 2017 you can also have the game move the actor to the nearest navmesh to avoid having to calculate the ground height, if they have been spawned in a navmesh chunk behind the player, that would move them to that navmesh chunk. https://www.creationkit.com/fallout4/index.php?title=MoveToNearestNavmeshLocation_-_ObjectReference Link to comment Share on other sites More sharing options...
Cobal Posted April 9, 2017 Author Share Posted April 9, 2017 (edited) Cheers guys, I'l get on experimenting with that :smile: Edited April 9, 2017 by Cobal Link to comment Share on other sites More sharing options...
Recommended Posts