#thisShip velocity thisShip transform

1 messages · Page 1 of 1 (latest)

atomic sapphire
#

lets make thread here so we don't flood channel

#

@weak glen in here

weak glen
#

ok thanks

atomic sapphire
#

just to be sure the direction is good

weak glen
atomic sapphire
#

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");
    }```
weak glen
#

ok... just a second

#

now it my spaceship doesnt even turn or rotate

atomic sapphire
#

what is your current code

#

send whole script !code

lone cairnBOT
#
Posting code

📃 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.

weak glen
atomic sapphire
#

why do u still have Time.deltaTime * Input.GetAxis("Throttle");

#

oh thats nother method

#

so its not moving or just not rotating?

weak glen
#

not moving or rotating

atomic sapphire
#

do you have errors in console?

weak glen
#

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)

atomic sapphire
#

reassign it like it says

#

it happens when you switch types but dont drag new reference again

weak glen
#

ok

#

?

atomic sapphire
#

did you fix it?

weak glen
#

yes, so now my spaceship is rotating but not moving

atomic sapphire
weak glen
#

it's not kinematic

atomic sapphire
#

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

weak glen
#

still not working 🙂

atomic sapphire
weak glen
#

did you mean this?

atomic sapphire
#

no i dont

#

the rigidbody component

#

in playmode

weak glen
atomic sapphire
weak glen
#

?

atomic sapphire
#

this is 2022 ? because you should b able to see the velocity info and all that..

weak glen
#

2022.3.3f1

atomic sapphire
#

yeah normally this showsup

weak glen
#

hmm

#

strange?

atomic sapphire
#

Window > Analysis > Physics Debugger

weak glen
#

so here is pic from physics debugger when throttling in game

#

spaceship isn't moving anywhere

atomic sapphire
weak glen
#

yep

atomic sapphire
#

also did you try it without Turn() method

weak glen
#

i did.

atomic sapphire
#

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

weak glen
#

so now it's reset

atomic sapphire
#

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

weak glen
#

mesh filters and mesh renderers. not static or another rigidbody

atomic sapphire
weak glen
atomic sapphire
#

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

weak glen
#

box collider is there, it's just a little small 🙂 have to try this