Projection on an object
#1

Hi I am looking for a way to calculate a in-world position from a relative position to an object.

I tried looking at MathPlugin(which is an awesome plugin btw) and it's source, but it didn't help me

Does anyone have ever made some code to do this / knows how to do this?

Thanks!
Reply
#2

I might have misunderstood something but isn't it just to add the relative position to each coordinate of the object?
Reply
#3

Quote:
Originally Posted by Flyfishes
Посмотреть сообщение
I might have misunderstood something but isn't it just to add the relative position to each coordinate of the object?
Nope, you are forgetting the rotations

I can do some simple calculations with one-axis rotations, but with this 3D environment I have no clue how to deal with it
Reply
#4

I don't understand what do you want to do.

Quote:

calculate a in-world position from a relative position to an object

What do you mean? In-world you mean real life or in-game? I don't get it.
Reply
#5

Example, I have this object

Код:
new obj = CreateObject(2587, 10.0, 10.0, 10.0, 90.0, -90.0, 180.0);
now I want to calculate where the relative position 0.0, 2.0, 1.0 is.
This would be in front of the object, somewhere near 10.0 11.8, 11.3.
That's what I'm trying to calculate

edit:
basically this whilst I got the offset within the space:
Reply
#6

I know what he wants to do, but unfortunately I suck at trigonometry so I have no idea how to do this either. The idea is this:

You have a vehicle/object in the game world at a position, let's say 1500.0, 1200.0, 15.0 with angles 0.0, 0.0, 30.0.
Relative to this vehicle/object is an attached object with offset -0.5, 0.25, 0.15 and rotation 0.0, 0.0, 180.0.
Now he wants to know to position of this second object in relation to the world, rather than in relation to its parent vehicle/object.
Reply
#7

I know some functions of the MathPlugin can do it with vehicles, but it uses the vehicle's rotation matrix instead of it's angles..
(I tried figuring out how he did it in his plugin)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)