Jump to content

Throw object


EUX adamant4

Recommended Posts

Hello yet again,

 

I am trying to work out how to throw and object from one point to another, but only to throw that object within a certain angle (through the X Y and Z axis). ive been trying to work this out for some time now, but havent cracked it yet (should have paid more attention to maths in school, i guess lol)

 

An explanation on how to do this would be greatly appreciated

Link to comment
Share on other sites

  • 2 weeks later...

a can you make it throw rocks that will be funny lol and if your done with it can you give the link.... Shifty41s_beerhatsmilie2.gif

Link to comment
Share on other sites

example:

 

0392: make_object 0@ moveable 1 1@ = object.Angle(0@)02F6: 2@ = sine 1@ // (float) 02F7: 3@ = cosine 1@ // (float) 0381: throw_object 0@ velocity_in_direction 2@ 3@ 0.5

 

 

not all objects can be thrown, only objects with physics, such as #BBALL_COL

but you can attach your object TO a BBALL_COL and throw the BBALL_COL, its the same...

Link to comment
Share on other sites

lol, didnt expect this thread to get a reply

 

That code you pasted shows the problem- i have done everything except i cannot find the Z value to adjust the pitch that an object is thrown.

 

as far as i know an opcode doesnt exist for this?

Link to comment
Share on other sites

not really, because that isnt dependent on the pitch- this is for a vehicle, where the Z values are important- i didnt mention that earlier, but i guess it can still be used while on foot by using 068D and 068E.

 

the reason why i posted this thread is because i could find the X and Y relative to the direction of the player/car/whatever easily, its just the Z that i cant figure out.

 

er... if my car is facing downwards, i dont want the object to be thrown upwards, do i? tounge.gif

Link to comment
Share on other sites

i guess you could just use move_object, that way you can just store the coords from the car

like that

 

0407: store_coords_to 1@ 2@ 3@ from_car 0@ with_offset 0.0 0.0 5.0034E: move_object 5@ to 1@ 2@ 3@ speed 0.1 0.1 0.1 collision_check 1

 

Link to comment
Share on other sites

yeah, that was the first thing i tried but it didnt move directly to the coords, it took right-angles and was very glitchy. And i would also need to get the target coords in the first place to make it fire directly ahead, which i did, but was too glitchy so i scrapped it. tounge.gif

 

Everything in my script works except for the Z axis thing, but if that works it would work perfectly

 

Link to comment
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

×
×
  • Create New...

Important Information

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