Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!   (91,977 visits to this link)

    2. News

    1. GTA Online

      1. Find Lobbies & Players
      2. Guides & Strategies
      3. Vehicles
      4. Content Creator
      5. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    4. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    9. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption 2

    2. Red Dead Redemption

    3. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Forum Support

    2. Site Suggestions

pmillett

Help with Native Function

Recommended Posts

pmillett

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.

Share this post


Link to post
Share on other sites
julionib

you can try:

 

ATTACH_OBJECT_TO_CAR_PHYSICALLY

 

http://www.gtamodding.com/index.php?title=..._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...

Share this post


Link to post
Share on other sites
pmillett

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.

Edited by pmillett

Share this post


Link to post
Share on other sites
nixolas1

 

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

 

 

Works wink.gif

Share this post


Link to post
Share on other sites
pmillett

ok, we'll try that first.

Share this post


Link to post
Share on other sites
pmillett

it didn't work

 

this is the 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.

Edited by pmillett

Share this post


Link to post
Share on other sites
julionib
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?

Share this post


Link to post
Share on other sites
nixolas1
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.

Share this post


Link to post
Share on other sites
pmillett

We fixed it. thank you smile.gif

Share this post


Link to post
Share on other sites
reaszon

whats the point of this mod?

Share this post


Link to post
Share on other sites

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

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.