From what I understand you can access the speed value of a rigidbody by typing: rigidbody.velocity
for some reason it gives me the error: ‘Rigidbody’ does not contain a definition for ‘velocity’
(attached).
What am I doing wrong? I also attached the entire script in case there could be a definition problem.
Given the error you most likely named one of your own classes “Rigidbody”. That class hides Unity’s “UnityEngine.Rigidbody” class. You should generally avoid using any names of built-in classes for your own.
So the best solution is to rename your Rigidbody class into something else. If you want to keep that name you have to use the “fully qualified type name” UnityEngine.Rigidbody
every time you want to refer to Unity’s Rigidbody class.
First, why are you getting a Rigidbody component from a Rigidbody?
m_Rigidbody = GetCompoent<Rigidbody>();