dzek (varez) Posted November 14, 2010 Share Posted November 14, 2010 hi, im looking for way to get a point like 10units before my car. i get function do to this- but it ignores Z position. i need to make it work with any rotation. function: function getPositionRelatedToVehicle(theVeh, val) local xx, yy, zz = getElementPosition(theVeh) local rx, ry, rot = getElementRotation(theVeh) local lx = xx + math.sin (math.rad(-rot)) * val local ly = yy + math.cos (math.rad(-rot)) * val return lx,ly end Link to comment
Aibo Posted November 14, 2010 Share Posted November 14, 2010 i second that request. have the same issue in my "omg" resource (need to correctly attach an object to main object if main is rotated by any axis, currently only Z rotation is fine). it's not that i have no idea how to do this, in fact i do. but all these matrix calculations, euler angles and other math stuff are making my brain hurt. and i'm not even a programmer, im a designer. :3 Link to comment
dzek (varez) Posted November 14, 2010 Author Share Posted November 14, 2010 hell, i though you replied i was thinking about attaching an object (like invisible corona) to car - and get pos of corona - much simpler, as the offset X, Y, Z while attaching are including source rotation. but i would like more to make it via pure scripting. Link to comment
AdiBoy Posted November 14, 2010 Share Posted November 14, 2010 here: https://wiki.multitheftauto.com/wiki/Get ... ceRotation Link to comment
dzek (varez) Posted November 14, 2010 Author Share Posted November 14, 2010 i know about this, lol i'm not the guy that can't check the wiki before asking. this function about is for something totally different, and it's returning X and Y only too. Link to comment
Wojak Posted November 15, 2010 Share Posted November 15, 2010 and wtat is wrong with this: https://wiki.multitheftauto.com/wiki/GetElementMatrix ? Link to comment
eAi Posted November 15, 2010 Share Posted November 15, 2010 The example on https://wiki.multitheftauto.com/wiki/GetElementMatrix looks like it does what you want to me? Link to comment
greacius Posted November 17, 2010 Share Posted November 17, 2010 viewtopic.php?f=91&t=24355&p=289767&hilit=Pickup+in+Front+of+player#p289767 maybe this is what you are looking for? Link to comment
dzek (varez) Posted November 17, 2010 Author Share Posted November 17, 2010 i'll try all these solutions when i'll find some free time, thanks, ill post the result 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