Jump to content

attachElementToElement won't work forever?


CodeMaster

Recommended Posts

I've made a helicopter magnet part in my Mass Warfare, but I've noticed something strange when using attachElementToElement().

When I fly roughly and fast, and then pull up (press key down) attached vehicle simply detaches and catapults out.

I'm not sure should I paste the code since its quite simple, and has no detach part for a test (to be sure that it's detaching automatically, not by a script).

Anyone had similar experiences, or has any solution?

Link to comment
I dint know if this has anything to do with this, but when I use my lil tractor, and attach a car to it, the car is launched.

Not relevant at all...

Anyway, I indeed kind of noticed the same thing, (see HERE) but didn't know it's exact cause. It seems like a bug with attachElementToElement, and not related to the script itself. So no need to post it up. :)

Link to comment

I'll release it with the whole Mass Warfare GM, it'll be easy to understand, since the whole GM is made from separate scripts, like the one for helimagnet.

And your tractor thingy has something to do with actually. I think that the GTA's physics system is actually freaking off, since the element being frozen. I think we'll need to work it out manually, but I bet that it'd make low fps...

So currently best solution is attachElementToElement. Any ideas how to fix the bug? (except turning the collision of attached model off, since it says "may cause unwanted effects on vehicles with driver".)

EDIT: Yup same thing happens to me.

Link to comment
I think that the GTA's physics system is actually freaking off, since the element being frozen. I think we'll need to work it out manually, but I bet that it'd make low fps...

I'll tell you, that I have this gamemode where there's a SAM site on the roof of several Patriots. They can rotate, they follow your cam view.

Now the interesting part:

-It calculates the camera's rotation (since getCameraRotation is gone in 1.0)

-It detaches the SAM site

-It reattaches the SAM site, with a different rotation

So if this might stop the effect, it shouldn't really lag. Although I don't know if it can solve it... But worth a try, not? :)

So just try to detach and reattach it every render. It might stutter a little, but it's not THAT noticable. ;)

Link to comment

That's interesting idea, but it wouldn't work, since the launch needs just one frame, and at the moment of detaching it'd be already in offset from the Cargobob. Doing this with several sharp turns, my vehicle would be now driven on the land instead of being "carried". :lol:

setElementCollisionsEnabled might work but it's client side, and it could bug while driver is inside...

Link to comment
I think that the GTA's physics system is actually freaking off, since the element being frozen. I think we'll need to work it out manually, but I bet that it'd make low fps...

I'll tell you, that I have this gamemode where there's a SAM site on the roof of several Patriots. They can rotate, they follow your cam view.

Now the interesting part:

-It calculates the camera's rotation (since getCameraRotation is gone in 1.0)

-It detaches the SAM site

-It reattaches the SAM site, with a different rotation

So if this might stop the effect, it shouldn't really lag. Although I don't know if it can solve it... But worth a try, not? :)

So just try to detach and reattach it every render. It might stutter a little, but it's not THAT noticable. ;)

Bear in mind setElementAttachedOffsets as of 1.0 is meant for this purpose.

Link to comment
Bear in mind setElementAttachedOffsets as of 1.0 is meant for this purpose.

I had a little trouble with it. And when I asked on IRC, I was told to do it this way.

To see what trouble I had: video download HERE. (For the ones not trusting the vid or anything; All you'd see is the turret apparently rotating over all axis', while I only define the X, Y, Z and RZ one... And it seems to be rotating hell too fast too... =/)

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...