#rotation issue
1 messages · Page 1 of 1 (latest)
Can you sent the screenshot here?
Btw it is against the rules to DM Unity staff 😄
No worries, let's try and fix the issue 🙂
You want me to send the pivot like that?
Is local world space selected?
So... When does the rotation not work? Only when spawned? And now it does work...?
Global is selected and rotation dont work when I have spinObjects script declared to both of my objects bomb and money
When I remove this script then everything works fine but with no spin
I will show you right now
I will select right now
After you select that, where's the pivot?
I check the constraints and check those ones that were also in the balloon constraints, so i checked x and z positions and rotations except y pos and y rot
I select pivot right now
It was centered like you said
But
Let me test it
It won't change it
It just shows were the pivot of the GameObject is
Can you share the code?
No, it doesn't change anything
I think the problem wasn't about the pivot
I had it centered and balloon was flying fine, the others have problem
Now, I will send you the code I think the issue is in the code
{
// Our variables
public float spinSpeed = 50;
void Start()
{
}
// Update is called once per frame
void Update()
{
transform.Rotate(Vector3.up * spinSpeed * Time.deltaTime);
}
}```
Seems good to me.
{
private PlayerControllerX playerControllerScript;
private float leftBound = -10;
public float speed = 10;
// Start is called before the first frame update
void Start()
{
playerControllerScript = GameObject.Find("Player").GetComponent<PlayerControllerX>();
}
// Update is called once per frame
void Update()
{
// We give speed only to our background
if (playerControllerScript.gameOver == false)
{
transform.Translate(Vector3.left * speed * Time.deltaTime);
}
// If object goes off screen that is NOT the background, destroy it
if (transform.position.x < leftBound && gameObject.CompareTag("Bomb"))
{
Destroy(gameObject);
}
if (transform.position.x < leftBound && gameObject.CompareTag("Money"))
{
Destroy(gameObject);
}
}``` This is the code for the movement to the left
That won't influence those objects I assume?
Also just in case make them kinematic
What do you mean by that cuz I am a beginner I dont know?
Like 2-3 months experience
Wait constraints you mean
Ok
This is "New Recording - 8/1/2023, 5:29:47 μ.μ." by Stelios on Vimeo, the home for high quality videos and the people who love them.
Aha. I see the issue now
Really?
MoveLeft script is attached to it and it does this: transform.Translate(Vector3.left * speed * Time.deltaTime);
So, I have to remove this script from these objects right?
Or remove that line of code 😛
I can't remove them. If I remove them they will not be moving to the left
Well. The way you move them to the left is not correct.
This script is attached also to the repeatBackground script
In combination with the rotation that will cause them to rotate around a pivot
The moveleft one is attached to the background
Maybe I have to make another script.
I will try to remove this line of code
And check it out
So, in your opinion where is the problem in which one of the scripts?
In move left one?
Haha it depends on what you want to achieve. If you just want to rotate the GameObject, then MoveLeftX script should not be attached to that bomb GameObject
Check what I want to accomplish but with spinSpeed for the bomb and the moneyhttps://vimeo.com/787331148/8986ae90be
This is "New Recording - 8/1/2023, 5:43:25 μ.μ." by Stelios on Vimeo, the home for high quality videos and the people who love them.
When I zero the spinspeed of these objects then the functionality of the game works pretty fine
When I give a value to the spinspeed something goes wrong