Can anyone help me with this problem or may I just be blind? It’s so that when I play in the little window everything works fine. But when I “maximize on Play” the rocket thrust is much stronger but the rotation is the same.
Help is much appreciated.
Kind regards, The BlederGuy.
Hi BlenderGuy,
Welcome to our community!
What you wrote sounds like a known bug in Unity which prevents the rocket from flying properly when it is selected in the Hierarchy. Try to select something else and click into the game window once to set Unity’s focus on the game window again.
If that didn’t work, try to remove Time.deltaTime
from the AddRelativeForce method. Alternatively, test this potential solution in the Rocket.cs:
bool isThrusting = false;
private void RespondToThrustInput()
{
isThrusting = Input.GetKey(KeyCode.Space);
if (isThrusting)
{
ApplyThrust();
}
else
{
audioSource.Stop();
mainEngineParticles.Stop();
}
}
private void ApplyThrust()
{
if (!audioSource.isPlaying)
{
audioSource.PlayOneShot(mainEngine);
}
mainEngineParticles.Play();
}
private void FixedUpdate()
{
if (isThrusting)
{
rigidBody.AddRelativeForce(Vector3.up * mainThrust, ForceMode.Acceleration);
}
}
Did this fix the issue?
If it does and if you are experiencing issues with the rotation, you could apply this concept to the rotation code.
See also:
- Forum User Guides : How to mark a topic as solved
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.