Jump to content

[HELP] Projectile Direction


Recommended Posts

8 hours ago, Thomas_Nightfire said:

I will try it, thanks
Will reply

I've tried to set velocity, but idk how to set proper velocity to fire in certain XYZ point...
And even using velocity arguments, rocket sometimes flies not straight: after a few seconds changes direction to player camera or whatever I can't understand
Please help!

Link to comment
  • Moderators
On 02/12/2020 at 01:25, Thomas_Nightfire said:

I've tried to set velocity, but idk how to set proper velocity to fire in certain XYZ point...

Projectiles with an owner have their orientation pre-set based on the camera rotation.

Setting the orientation after the projectile creation, will only work when all clients are applying the same adjustments.

 

AFAIK only a full overwrite of the behaviour and synchronization will solve that problem.

  • Sad 1
Link to comment
  • Moderators
1 hour ago, Thomas_Nightfire said:

Can u please write a simple example how to overwrite it's behaviour?

You can for example create an object (server), use projectile model:

https://wiki.multitheftauto.com/wiki/CreateObject

 

Move the object (server):

https://wiki.multitheftauto.com/wiki/MoveObject

 

And when it hits something (client), checking with this function every frame:

https://wiki.multitheftauto.com/wiki/IsLineOfSightClear

https://wiki.multitheftauto.com/wiki/OnClientRender

 

Than you trigger to serverside and make an explosion:

https://wiki.multitheftauto.com/wiki/CreateExplosion

 

And yes it is not easy.

 

 

 

If not an overwrite:

1 hour ago, Thomas_Nightfire said:

And if rocket blows up something, who's be responsible for it? Owner?

  • The player that creates the projectile:

    projectile createProjectile ( element creator, int weaponType [, float posX, float posY, float posZ, float force = 1.0, element target = nil, float rotX, float rotY, float rotZ, float velX, float velY, float velZ, int model ] )
    https://wiki.multitheftauto.com/wiki/CreateProjectile
     
  • If the vehicle creates it, the owner should be either the vehicle controller or the syncer.

 

Edited by IIYAMA
  • Thanks 1
Link to comment
On 07/12/2020 at 22:27, IIYAMA said:

You can for example create an object (server), use projectile model:

https://wiki.multitheftauto.com/wiki/CreateObject

 

Move the object (server):

https://wiki.multitheftauto.com/wiki/MoveObject

 

And when it hits something (client), checking with this function every frame:

https://wiki.multitheftauto.com/wiki/IsLineOfSightClear

https://wiki.multitheftauto.com/wiki/OnClientRender

 

Than you trigger to serverside and make an explosion:

https://wiki.multitheftauto.com/wiki/CreateExplosion

 

And yes it is not easy.

 

 

 

If not an overwrite:

  • The player that creates the projectile:

    projectile createProjectile ( element creator, int weaponType [, float posX, float posY, float posZ, float force = 1.0, element target = nil, float rotX, float rotY, float rotZ, float velX, float velY, float velZ, int model ] )
    https://wiki.multitheftauto.com/wiki/CreateProjectile
     
  • If the vehicle creates it, the owner should be either the vehicle controller or the syncer.

 

Nice... thought another way exists, but thank you ;)

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