Woovie Posted February 2, 2008 Share Posted February 2, 2008 So attachElementToElement works. But I am curious, how do I get coordinates relative to the object you a chillin by ? Like if I stand on a boat, I want to do /getpos relative to the boat. Understand ? Link to comment
Twig Posted February 3, 2008 Share Posted February 3, 2008 http://development.mtasa.com/index.php? ... actElement Get the position of that element and the player etc. etc. Link to comment
norby89 Posted February 3, 2008 Share Posted February 3, 2008 (edited) http://development.mtasa.com/index.php?title=GetPlayerContactElementGet the position of that element and the player etc. etc. I don't think that's what he needs, it's not that easy as it sounds he'd like to attach the player so it remains in the same position it involves rotations and trigonometry, I suggest looking for snippets on the Internet, you might find something Edited February 3, 2008 by Guest Link to comment
Woovie Posted February 3, 2008 Author Share Posted February 3, 2008 That is handy. Thanks Twig. I will post if it works. Link to comment
norby89 Posted February 3, 2008 Share Posted February 3, 2008 I think I understand what Twig means. Find the world positions of each object, get the difference, and that SHOULD be what I am looking for. that would only work if the vehicle's rotation was 0, 0, 0 Link to comment
Twig Posted February 3, 2008 Share Posted February 3, 2008 I never claimed to give the final answer, I just point people in the right direction Also I know it's not that easy but tbh it's not really very hard either. Link to comment
norby89 Posted February 3, 2008 Share Posted February 3, 2008 I never claimed to give the final answer, I just point people in the right direction lol it's cool what I meant is that if you only find the positions and get the differences and use them as offsets for attachElementToElement, it will probably attach you in the wrong position I suck at explaining but I'll try anyway, in this pic the square is a vehicle and the dot is the player: (pic a) the vehicle's position and rotation is ( 0, 0, 0 ) the player is located a little bit to the south, ( 0, -1, 0 ) which means newX = x2 - x1 = 0 newY = y2 - y1 = -1 newZ =z2 - z1 = 0 ( 0, -1, 0 ) would be correct but if the vehicle is rotated 90 degrees to the right (pic b) the offsets would be.. newX = x2 - x1 = -1 newY = y2 - y1 = 0 newZ =z2 - z1 = 0 and the player would be attached to the left of the vehicle because attachElementToElement still expects ( 0, -1, 0 ) you need something that calculates the right offsets regardless of the vehicles rotation Link to comment
Woovie Posted February 3, 2008 Author Share Posted February 3, 2008 Still would be fairly easy. I am working on the code ATM. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now