Skip to content

Quick Start Guide

Eidolon.Newton3D is a convenient utility provided by Eidolon, designed to simplify and enhance the usage of Unity Physics 3D. This static class offers a set of methods to streamline common operations on 3D rigidbodies, providing a more straightforward and expressive API for game developers.

1. Applying Force

Easily apply a force to a 3D rigidbody with the ApplyForce method. This function allows you to specify the force vector, providing a clean and efficient way to handle force application.

// Apply a force to a 3D rigidbody
Newton3D.ApplyForce(rigidbody3D, new Vector3(10f, 0f, 5f));

2. Setting Velocity

Effortlessly set the velocity of a 3D rigidbody using the SetVelocity method. By providing the new velocity, this function simplifies the process, enhancing the clarity of your code.

// Set the velocity of a 3D rigidbody
Newton3D.SetVelocity(rigidbody3D, new Vector3(5f, 2f, 8f));

3. Simulating a Jump

Simulate a jump in your 3D game using the Jump method in Newton 3D. Specify the rigidbody and the force for the jump, making the implementation intuitive and straightforward.

// Simulate a jump by applying an upward force
Newton3D.Jump(rigidbody3D, 20f);

4. Setting Constraints

Efficiently manage constraints on a 3D rigidbody with the SetConstraints method. This function offers a human-friendly approach to freezing or unfreezing positions and rotations along the X, Y, and Z axes.

// Set constraints on a 3D rigidbody
Newton3D.SetConstraints(rigidbody3D, true, false, true, false, true, false);

5. Applying Torque

Apply torque to a 3D rigidbody effortlessly using the ApplyTorque method. Provide the rigidbody and the torque vector, and Newton 3D takes care of the rest, making your code expressive and easy to understand.

// Apply torque to a 3D rigidbody
Newton3D.ApplyTorque(rigidbody3D, new Vector3(0f, 5f, 0f));

6. Applying Linear Damping

Effortlessly apply linear damping to a 3D rigidbody with the ApplyLinearDamping method. Manage linear damping factors with clarity, enhancing control and readability.

// Apply linear damping to a 3D rigidbody
Newton3D.ApplyLinearDamping(rigidbody3D, 2f);

7. Applying Angular Damping

Apply angular damping to a 3D rigidbody using the ApplyAngularDamping method. This function streamlines the application of angular damping, making your code clean and comprehensible.

// Apply angular damping to a 3D rigidbody
Newton3D.ApplyAngularDamping(rigidbody3D, 1f);

8. Applying Force at Position

Precisely apply a force to a 3D rigidbody at a specific position with the ApplyForceAtPosition method. Enhance the precision of your game physics without compromising on clarity.

// Apply a force to a 3D rigidbody at a specific position
Newton3D.ApplyForceAtPosition(rigidbody3D, new Vector3(2f, 1f, 3f), new Vector3(3f, 2f, 1f));

9. Applying Torque at Position

Fine-tune your game’s rotational dynamics with the ApplyTorqueAtPosition method in Newton 3D. This function enables precise torque application around a specific point on a 3D rigidbody.

// Apply torque to a 3D rigidbody around a specific point
Newton3D.ApplyTorqueAtPosition(rigidbody3D, new Vector3(3f, 0f, 0f), new Vector3(1f, 2f, 3f));

10. Simulating Linear and Angular Drag

Simulate linear and angular drag effortlessly with the ApplyLinearDrag and ApplyAngularDrag methods. Fine-tune your game’s drag effects with clear and concise functions.

// Apply linear drag to simulate linear drag
Newton3D.ApplyLinearDrag(rigidbody3D, 0.1f);
// Apply angular drag to simulate rotational drag
Newton3D.ApplyAngularDrag(rigidbody3D, 0.05f);

Conclusion

Newton 3D offers a comprehensive suite of methods to simplify and enhance your interactions with 3D rigidbodies in Unity. Whether you’re a seasoned developer or just starting, Newton 3D makes your code cleaner and your game physics interactions smoother. Happy coding! 🚀