Jump to content

Help please


Recommended Posts

Ok i need some help with attachElements

Let's say i have two objects with coordinates at 1185.015625, 3690.5087890625, 6.9000000953674 and 1177.4794921875, 3687.2998046875, 40.140277862549 to attach them i have put: attachElements ( object1, object 2, 0, 0, 0 ) How can i Attach the two of them but have them stay at their coordinates?

Link to comment

When you attach elements they are attached to one object with specific offset. If you offset it at 0,0,0 then it will be at the place of the element that you attach the element to. So, you need to offset it by the coords difference that these 2 elements are located to each other. You can solve it like so:

local x,y,z = getElementPosition( object1 );
local xx,yy,zz = getElementPosition( object2 );
local offsetX, offsetY, offsetZ = x - xx, y - yy, z - zz;
attachElements( object1, object2, offsetX, offsetY, offsetZ ); -- you may have to swap over object1 with object2

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...