- Home /
Can I fake physics?
I've been following a series of tutorials on how to make a simple multiplayer FPS game. He shows us how to set up PUN (Photon Unity Network) multiplayer. Apparently, PUN is not good for syncing anything that has to do with physics. I want to make a throwing knife that players can throw at eachother (odd, I know). Of course this requires physics. Is it possible to fake it, maybe using ray casting? Is my logic correct? With no physics is there a way I could still see a knife flying in the air?
Why not just make your own projectile physics? Using the formula's isn't really that hard, but collision is another question...
If you need to implement Unity-Engine specific functionality on a server the easiest solution would be to write your server using Unity, ins$$anonymous$$d of some third party software.
Answer by tobyfee · Mar 14, 2014 at 07:17 PM
Usually when people talk about not using physics they mean not using Rigidbody.AddForce and instead using Translate and Rotate to move objects. It's easy to imagine how you could simulate the arc of a knife flying through the air with translate, just do something like (pseudocode):
onStart
i=0;
onUpdate
Move up (2);
Move Forward (3);
Move Down (i);
i ++;
//(to simulate gravity accelerating you downward)
As for hitting someone with the knife, you could use raycasts but you'll probably be happier with the general feel of a spherecast. It can detect collisions inside a volume of space easily.
http://docs.unity3d.com/Documentation/ScriptReference/Physics.SphereCast.html
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Not firing a ray (C#) 1 Answer
Melee-like function? 1 Answer
RAYCAST KNOWLEDGE HELP!!! 1 Answer
Raycast length must be equal to the target distance 2 Answers