Hi community,
excuse my rude question, but is there by chance a utility function to get a position relative to an Element taking all of its rotations into account? Basically I want to create a marker on the back of a car. In an ideal world, I would like to use it like attachElemtents: give it offset coordinates and rotations. The ideal form would be this:
float, float, float, float, float, float = getPositionRelativeToElementWithOffsets(element theElement, offsetPosX, offsetPosY, offsetPosZ, offsetRotationX, offsetRotationY, offsetRotationZ)
Returns:
float absoluteWorldPosX, float absoluteWorldPosY, float absoluteWorldPosZ, float absoluteWorldRotationX, float absoluteWorldRotationY, float absoluteWorldRotationZ
The name is of course disputable.
If I e.g. use GetPointFromDistanceRotation I can neither give exact offset positions nor any rotations. Also, if the car is on an angle down, the marker will not be on the back of the car but inside of it.
So, do you guys know of such a function? Are there any mathematicians among you guys that know trigonometry in a three dimensional coordinate system?
EDIT:
Maybe I should also say that I tried a workaround by attaching a dummy that I grab the coords off to then delete it again, but that didn't work either:
local posX, posY, posZ = getElementPosition(vehicle)
local dummy = createObject(3910, posX, posY, posZ)
attachElements(dummy, vehicle, -0.0, 0.5, 1.5, 0, 0, 0)
local posX2, posY2, posZ2 = getElementPosition(dummy)
destroyElement(dummy)
local marker = createMarker(posX2, posY2, posZ2, "cylinder", .5, 255, 255, 0, 255, root)
didn't work here means that posX == posX2...