Quantcast

Jump to content

» «
Photo

Help with Native Function

9 replies to this topic
pmillett
  • pmillett

    The Dragon King

  • Members
  • Joined: 05 Feb 2008

#1

Posted 27 August 2013 - 11:02 PM

Ok, so we have Doc's Truck from back to the future in GTA IV (as part of a future BTTF:HV release).. And we coded the back door to open up and drive the delorean into... however, when we attach the the parts to the truck, they're placed without a collision and you can walk right through them. Any advice on how to do fix this problem??

*EDIT* If we spawn the objects without attaching to the car, the collisions work just fine.. it's when we attach them to the car that there's a problem.

julionib
  • julionib

    Coder

  • Members
  • Joined: 13 Sep 2012
  • Brazil

#2

Posted 28 August 2013 - 03:28 AM

you can try:

ATTACH_OBJECT_TO_CAR_PHYSICALLY

http://www.gtamoddin..._CAR_PHYSICALLY

but the attach point is a little weird and you need to control rotation in a tick to avoid spinning, also you can use this as a invisible object with controlled rotation, and have the visual one attached with ATTACH_OBJECT_TO_CAR.

maybe you need to reset the object mass to avoid/reduce worst results:

Native.Function.Call("SET_OBJECT_PHYSICS_PARAMS", TheObject, 500.0, -1.0, 0, 0, 0, 0)

im not sure how this works exactly but i know that 500.0 is the new mass...

pmillett
  • pmillett

    The Dragon King

  • Members
  • Joined: 05 Feb 2008

#3

Posted 28 August 2013 - 02:38 PM Edited by pmillett, 28 August 2013 - 02:50 PM.

Thanks, will try it....

On another note, something I forgot to mention... The collision appears at the very bottom of the ramp as a small section.. then disappears as the ramp folds up and down.. that's the only part that works... and it's extremely weird.

nixolas1
  • nixolas1

    Creator/Destroyer

  • Members
  • Joined: 23 Dec 2008
  • None

#4

Posted 28 August 2013 - 03:18 PM

CODE
AttachObjectToCar(object, veh, 0, ofx, ofy, ofz, xRot, yRot, zRot);
SetObjectCollision(object,1);


Works wink.gif

pmillett
  • pmillett

    The Dragon King

  • Members
  • Joined: 05 Feb 2008

#5

Posted 28 August 2013 - 06:31 PM

ok, we'll try that first.

pmillett
  • pmillett

    The Dragon King

  • Members
  • Joined: 05 Feb 2008

#6

Posted 28 August 2013 - 07:28 PM Edited by pmillett, 28 August 2013 - 08:02 PM.

it didn't work

this is the code:

CODE
Sub UpdatePos()
       Native.Function.Call("ATTACH_OBJECT_TO_CAR", o_backdoor, DeLoreans.Truck.Car, 0, 0, ybackdoor, zbackdoor, 0.0, rotBackdoor, Math.PI / 2)
       Native.Function.Call("SET_OBJECT_COLLISION", o_backdoor, 1)
       If DeLoreans.Truck.rampOpen Then posRamps = DeLoreans.Truck.Car.GetOffset(o_backdoor.GetOffsetPosition(offRamps)) Else posRamps = DeLoreans.Truck.Car.GetOffset(o_backdoor.GetOffsetPosition(offRamps2))
       posRods = DeLoreans.Truck.Car.GetOffset(o_backdoor.GetOffsetPosition(offRods))
       posStabilizer = DeLoreans.Truck.Car.GetOffset(o_backdoor.GetOffsetPosition(offStabilizer))
       xAdj = DeLoreans.Truck.Car.GetOffset(o_backdoor.Position).X
       yAdj = Math.Abs(DeLoreans.Truck.Car.GetOffset(o_backdoor.Position).Y) - Math.Abs(ybackdoor)
       zAdj = Math.Abs(DeLoreans.Truck.Car.GetOffset(o_backdoor.Position).Z) - Math.Abs(zbackdoor)
       Native.Function.Call("ATTACH_OBJECT_TO_CAR", o_ramps, DeLoreans.Truck.Car, 0, posRamps.X - xAdj, posRamps.Y + yAdj, posRamps.Z + zAdj, 0, rotYRamps, (Math.PI / 2))
       Native.Function.Call("SET_OBJECT_COLLISION", o_ramps, 1)
       Native.Function.Call("ATTACH_OBJECT_TO_CAR", o_rods, DeLoreans.Truck.Car, 0, posRods.X - xAdj, posRods.Y + yAdj, posRods.Z + zAdj, 0, rotYRods, Math.PI / 2)
       Native.Function.Call("SET_OBJECT_COLLISION", o_rods, 1)
       Native.Function.Call("ATTACH_OBJECT_TO_CAR", o_stabilizer, DeLoreans.Truck.Car, 0, posStabilizer.X - xAdj, posStabilizer.Y + yAdj, posStabilizer.Z + zAdj, 0, 0, -Math.PI / 2)
       Native.Function.Call("SET_OBJECT_COLLISION", o_stabilizer, 1)
   End Sub


*EDIT* I lied, it does work.. but only as the doors open and close.. once they are fully opened, the collision stops working again.

julionib
  • julionib

    Coder

  • Members
  • Joined: 13 Sep 2012
  • Brazil

#7

Posted 28 August 2013 - 09:12 PM

QUOTE (nixolas1 @ Wednesday, Aug 28 2013, 15:18)
CODE
AttachObjectToCar(object, veh, 0, ofx, ofy, ofz, xRot, yRot, zRot);
SetObjectCollision(object,1);


Works wink.gif

thats nice, never tryed ^^

the rotation must be controlled or its frozen like normal attach?

nixolas1
  • nixolas1

    Creator/Destroyer

  • Members
  • Joined: 23 Dec 2008
  • None

#8

Posted 29 August 2013 - 09:47 AM

QUOTE (julionib @ Wednesday, Aug 28 2013, 22:12)
QUOTE (nixolas1 @ Wednesday, Aug 28 2013, 15:18)
CODE
AttachObjectToCar(object, veh, 0, ofx, ofy, ofz, xRot, yRot, zRot);
SetObjectCollision(object,1);


Works wink.gif

thats nice, never tryed ^^

the rotation must be controlled or its frozen like normal attach?

its like normal attach, you just have to set it after attaching again.

pmillett
  • pmillett

    The Dragon King

  • Members
  • Joined: 05 Feb 2008

#9

Posted 30 August 2013 - 09:12 PM

We fixed it. thank you smile.gif

reaszon
  • reaszon

    Player Hater

  • Members
  • Joined: 26 Jul 2012

#10

Posted 08 September 2013 - 02:41 PM

whats the point of this mod?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users