Code: Select all
local pos = player:get_pos()
local look_dir = player:get_look_dir()
local distance_away = 5
local pos_in_front = {x=pos.x+(look_dir.x*distance),y=pos.y+(look_dir.y*distance),z=pos.z+(look_dir.z*distance)
Code: Select all
local pos = player:get_pos()
local look_dir = player:get_look_dir()
local distance_away = 5
local pos_in_front = {x=pos.x+(look_dir.x*distance),y=pos.y+(look_dir.y*distance),z=pos.z+(look_dir.z*distance)
Code: Select all
{x=pos.x+(look_dir.z*distance),y=pos.y,z=pos.z+(look_dir.x*distance)
ATTENTION: this works only with 2D !!!Walker wrote: ↑Sat Jul 04, 2020 06:40you need to swap the X,Y and Z variables from distance ...
liketry also to replace some "+" with some "-"Code: Select all
{x=pos.x+(look_dir.z*distance),y=pos.y,z=pos.z+(look_dir.x*distance)
hint: to transform a vextor by a angle x ... you need to use +/-sin() and +/-cos() ... but if x = 90 ... you only need to swap variables because +/-sin() and +/-cos() are -1, 0 or 1 ... i hope ;)
Lets Try&Error xD
Users browsing this forum: No registered users and 6 guests