Jump to content

Tutorial program didn't work (2. Creating the Controllable Character)


photo

Recommended Posts

I've checked the character's code, seems like it's ok.

The problem may be caused by the fact, that the robot is placed slightly lower than the floor (due to collisions with floor tiles), could you try and lift it up a bit to see if it starts moving and rotating properly?

 image.png

Hope this helps!

Link to comment
15 hours ago, fox said:

Hi Black_Cat!

Thanks for reporting, we'll check this out ASAP!

Is it a C# version of the guide, that you're trying to follow?

Oops! Sorry! Yes, it's C#.

45 minutes ago, fox said:

I've checked the character's code, seems like it's ok.

The problem may be caused by the fact, that the robot is placed slightly lower than the floor (due to collisions with floor tiles), could you try and lift it up a bit to see if it starts moving and rotating properly?

 Hope this helps!

Very thanks!

But this wasn't robot itself. It was Capsule collider.

Link to comment
9 hours ago, Black_Cat said:

But this wasn't robot itself. It was Capsule collider.

Yep, it's the collider of course. I was just referring to it as a whole ;-)

You're welcome! Glad it helped!

Link to comment

Hmmm...

Intersection of colliders stops rotating. Why doesn't the intersection stop moving? 

API Docs said: "void SetPreserveTransform ........ This method safely preserves ...."

Adding impulse is less safe?

Link to comment

Let me explain these one by one...

6 hours ago, Black_Cat said:

Intersection of colliders stops rotating. Why doesn't the intersection stop moving? 

There are 2 types of collisions supported in UNIGINE:

  • Shape - Shape (or Collider-Collider, as this may seem more familiar to you) - this is a collision between two physical objects.
  • Shape - Surface  - which is actually a collision between a physical object and some static non-physical geometry.

You can learn more about collision detection from this article.

So, the case with the robot and floor tiles is is rather a case of collision between a capsule-collider of the robot and geometry (namely a surface of the floor having the Collision flag enabled). The surface itself is a flat plane which is too thin - that's why  such things in objects behavior that you describe may occur, the situation would be different if the floor tile had some thickness.

 

As for the SetPreserveTransform() method, "safely" here does not refer to thread safety or any issues. The difference between the SetTransform() and SetPreserveTransform() is that the first method "resets body's linear and angular velocities to defaults, sets forces and torques to zeros, nullifies counted down frozen frames", so in case you need to "shift" some moving physical object, while keeping its current forces, velocities and other physical parameters it is recommended to use SetPreserveTransform(). Adding impulses is ok and safe.

Hope it helps!

Link to comment
×
×
  • Create New...