Thomas_Nightfire Posted December 1, 2020 Share Posted December 1, 2020 Hey there! Is there a way to set projectile a direction? I've tried to test Rocket, but it always fly to direction of player camera... Tried to set rotation of projectile, but it only changes rot of it, not the direction. Please help! Link to comment
Spakye Posted December 1, 2020 Share Posted December 1, 2020 Hello, did you try to set the velocity of the projectile when creating it ? you can do it in optional arguments of createProjectile() Link to comment
Thomas_Nightfire Posted December 1, 2020 Author Share Posted December 1, 2020 1 hour ago, Spakye said: Hello, did you try to set the velocity of the projectile when creating it ? you can do it in optional arguments of createProjectile() I will try it, thanks Will reply Link to comment
Thomas_Nightfire Posted December 2, 2020 Author Share Posted December 2, 2020 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 IIYAMA Posted December 6, 2020 Moderators Share Posted December 6, 2020 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. 1 Link to comment
Thomas_Nightfire Posted December 7, 2020 Author Share Posted December 7, 2020 23 hours ago, IIYAMA said: AFAIK only a full overwrite of the behaviour and synchronization will solve that problem. Can u please write a simple example how to overwrite it's behaviour? And if rocket blows up something, who's be responsible for it? Owner? Link to comment
Moderators IIYAMA Posted December 7, 2020 Moderators Share Posted December 7, 2020 (edited) 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 December 7, 2020 by IIYAMA 1 Link to comment
Thomas_Nightfire Posted December 11, 2020 Author Share Posted December 11, 2020 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now