#It s nothing personal from years of
1 messages · Page 1 of 1 (latest)
Looks like UI GameObjects.
Note: It's best to have a single UI script per canvas, because the order of object instantiation (and script execution) is unpredictable.
https://docs.unity3d.com/Manual/class-Rigidbody2D.html
(...)
While a Dynamic Rigidbody 2D is affected by gravity and forces, a Kinematic Rigidbody 2D isn’t.
(...)
Kinematic Rigidbody 2D is designed to be repositioned explicitly via Rigidbody2D.MovePosition or Rigidbody2D.MoveRotation
It's been a while since I was doing physics, but from what I recall and am reading, velocity has no effect for a Kinematic Rigidbody.
If it is working for other scenes, then it is obvious that you should share more of the code, as the movement code itself alone might not be what is wrong.
Since you are using a different hierarchy structure, and you are using a hardcoded way to reference objects, I suspect that is where the problem lies.
But what I suspect more, is that your code is moving Dynamic Rigidbodies, and not the Kinematic ones.
Because moving a Kinematic by velocity should be impossible, as it is unaffected by forces, of which velocity is a product.
Share the full script.
Share any full script that is relevant to the situation.
You could be right about your assumptions, but I'm not going to take that chance.
I've seen how this usually goes, and experienced it, many times.
I have been helping people on this server for a number of years.
If you will not share all the full scripts that could be relevant, then I know that I cannot help you.
To quote the starting post of this thread:
I have stopped helping people until I see a full script
That said, I wish you good luck. I am done for now.
My recommendation is that you share full scripts next time someone is free to help.
Or you could bypass the current solution, and make a new one from scratch.
There are many potential issues with having a Kinematic Rigidbody2D in a UI hierarchy.
And if that setup is required for the game's function, there are other ways to achieve the same result.
if you can explain in english terms how the game needs to work, I can give a few suggestions
Transform is used for scripted movement.
Dynamic Rigidbody is used for realistic movement and collisions.
Kinematic Rigidbody is used for scripted movement, with collision detection.
why is the trigger a UI Image, and not a World-space sprite?
Ok. In order to achieve what?
What I am struggling to understand, is why the objects of your game needs to be UI objects.
It is perfectly possible to connect UI and World-Space scripts via code.
This way of using the UI is also not very scalable.
due to how UI is rendered and performs
What I mean is that there is rarely any reason to use UI Objects to make a 2D game,
rather than just using normal game objects in world space, with a 2D camera.
Might be reasonable enough.
Anyway, the ice is literally melting over here. I gotta run.
The easiest workaround I can think of, is having UI objects syncronized with world-space objects, so the UI doesn't have any Rigidbody or Colliders.
Have a nice day o/