#thisShip velocity thisShip transform
1 messages · Page 1 of 1 (latest)
ok thanks
ok can you select the ship in Local Pivot mode, screenshot pivot (arrows)
just to be sure the direction is good
does rigidbody component show any velocity
when you're in playmode
also move that input out of fixed update and make a variable for it
like this
float throttleSpeed;
private void FixedUpdate()
{
thisShip.velocity += (throttleSpeed * boostSpeed * thisShip.transform.forward * Time.fixedDeltaTime);
}
private void Update()
{
throttleSpeed = Input.GetAxis("Throttle");
}```
📃 Large Code Blocks
Large code blocks should be posted as links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/
https://paste.myst.rs/, https://hastebin.com/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To get C# formatting the first line should only contain cs or csharp.
Add a comment with a line number if there is an error message.
```cs
// Your code here
```
Do not share screenshots of code unless requested.
why do u still have Time.deltaTime * Input.GetAxis("Throttle");
oh thats nother method
so its not moving or just not rotating?
not moving or rotating
do you have errors in console?
no
sorry..i have one now
MissingReferenceException: The variable thisShip of BlockFighter doesn't exist anymore.
You probably need to reassign the thisShip variable of the 'BlockFighter' script in the inspector.
UnityEngine.Rigidbody.get_velocity () (at <bbb49a5d74e5480fb0477e2877c9cd1e>:0)
BlockFighter.FixedUpdate () (at Assets/Scripts/SpaceShip/BlockFighter.cs:36)
ok fix that reference first
reassign it like it says
it happens when you switch types but dont drag new reference again
did you fix it?
yes, so now my spaceship is rotating but not moving
hmm are u sure its not set to kinematic
it's not kinematic
screenshot the Rigidbody component in playmode when you're pressing throttle
expand all the arrow fields
oh wait
you locked the Z position didn't u
i thought you were doing 2D
don't lock any constraints for position
still not working 🙂
i just tested it out its working for me, show me this with screenshot #1158085260077178920 message
did you mean this?
?
this is 2022 ? because you should b able to see the velocity info and all that..
2022.3.3f1
yeah normally this showsup
so here is pic from physics debugger when throttling in game
spaceship isn't moving anywhere
says its moving tho
yep
screenshot the complete object of ship, hierarchy and all
also did you try it without Turn() method
ur collider looks very off
reset the position to 0.0.0
"Center"
also that size is huge because your root object wasn't made as 1,1,1 scale
so now it's reset
is it on the mesh now?
it should be working.
what are the child objects of the ship? what kind of components they have?
is anything marked as Static maybe?
or another rigidbody
mesh filters and mesh renderers. not static or another rigidbody
can you show where is the collider is in playmode
I dont see ur box collider
make sure gizmos is enebaled
I think your issue is your object sizing and colliders are messing with the rigidbody properly
easy way to test this
make a new gameobject that is 3D cube, put rigidbody on it and add the same script and connect that rigidbody to it
see if it works fine
box collider is there, it's just a little small 🙂 have to try this