Abstract
In this chapter, we'll make use of raycasting to allow the player to point their camera at a GameObject with a Rigidbody and hold left-click to pull the object toward them or right-click to push it away from them. Rather than pulling and pushing by moving the Transform directly, we'll apply force to the Rigidbody so that the physics system handles the motion instead for us.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2020 Casey Hardman
About this chapter
Cite this chapter
Hardman, C. (2020). Pulling and Pushing. In: Game Programming with Unity and C#. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-5656-5_37
Download citation
DOI: https://doi.org/10.1007/978-1-4842-5656-5_37
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-5655-8
Online ISBN: 978-1-4842-5656-5
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books