Jump to content

Better positions for attached coronas?


Recommended Posts

I don't think it's a "bug", so I'll write about it here. When corona is attached to driving car, then it's displayed in its previous position (one frame back). It makes corona look moving roughly. I know it's possible to script smooth movement, but I think it's better when it's already in function. There are two ways to make the movement smooth: put corona into the position right before frame rendering. Actually I don't know if it's possible. Another way should work (I've tried it with SCM code in CLEO script). I get velocity of car in m/s, then multiply it by time from previous to current frame in seconds and then add result to the position. To make it easier to understand:

getcarposition posx posy posz //m

getcarspeed speedx speedy speedz //m/s

posx += speedx*timefromlastframe

posy += speedy*timefromlastframe

posz += speedz*timefromlastframe

drawcorona posx posy posz

...

I hope you understood me :) Code like this should make corona movement smooth. However, I'm not a programmer, so I don't know if it's easy to implement it into MTA code.

Link to comment

All markers have a bit laggy movement, very annoying with a little script I had made... You would see a teammarker above your teammates heads, but it was also on your own head and lagged while walking... -.-

Anyway, wouldn't setElementPosition(element,getElementPosition(theCarWhateverItsCalledBecauseIDontReallyCareBoutItsName)) be better? (if client-side, if server-side it might lag even more... xD)

Link to comment

Yeah, it's possible, but it's harder when we need to get the correct positions with certain offsets when element is rotated. At least to me, my trigonometry sucks a little bit :) It's not hard to get offset with two axis to me. But with three axis..... Well, maybe it's good way. At least I have some trigonometry knowledge, even though I haven't learned it at school yet :P

Link to comment
Yeah, it's possible, but it's harder when we need to get the correct positions with certain offsets when element is rotated. At least to me, my trigonometry sucks a little bit :) It's not hard to get offset with two axis to me. But with three axis..... Well, maybe it's good way. At least I have some trigonometry knowledge, even though I haven't learned it at school yet :P

Lol don't ask me bout trigonometry!! D:

But would there be an alternate method? In theory, the only thing that could (possibly) be faster is getElementPosition client-side... But that's not always a good choise I guess...

Would it work if you would attach it, and change offsets in some way while the object is moving? Not an expert in MTA yet, so I would like to know.

Link to comment

Well, if you keep attaching, detaching and then adding speed to the position every frame, then it should work. But hey, wouldn't it be better if attachElementToElement put attached elements into their positions before rendering frame, not after?

Link to comment
  • Recently Browsing   0 members

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