Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
It's just a phase, mom!
#1
Hello!

I have two questions about phases.

1. Is there a way to get a phase of an ObiActor? I know I can set one via SetPhase() and I think I can get a phase of a ObiCollider, but what about softbodies?

2. Can I adjust phases like physics collision layers in Unity? Here's why do I need this:
  • I need my softbody player to roll through the level, so I apply torque.
  • I need the player to push other similar sized softbody opponents like they're nothing, like a golf ball pushes table tennis balls. But as I apply torque, instead of pushing, player climbs over them. Setting all frictions to zero doesn't help. Reducing opponents masses makes things worse.
  • So I've attached a sphere with ObiCollider to my player.transform as a child and got it player's phase. Now the sphere does the pushing, but I need to prevent player from interacting with the opponents. But I need opponents to be able to interact with each other.
Thank you )
Reply
#2
(21-03-2021, 02:44 PM)the-lander Wrote: Hello!

I have two questions about phases.

1. Is there a way to get a phase of an ObiActor? I know I can set one via SetPhase() and I think I can get a phase of a ObiCollider, but what about softbodies?

2. Can I adjust phases like physics collision layers in Unity? Here's why do I need this:
  • I need my softbody player to roll through the level, so I apply torque.
  • I need the player to push other similar sized softbody opponents like they're nothing, like a golf ball pushes table tennis balls. But as I apply torque, instead of pushing, player climbs over them. Setting all frictions to zero doesn't help. Reducing opponents masses makes things worse.
  • So I've attached a sphere with ObiCollider to my player.transform as a child and got it player's phase. Now the sphere does the pushing, but I need to prevent player from interacting with the opponents. But I need opponents to be able to interact with each other.
Thank you )

1.- No, since phases are specified per-particle. It's perfectly fine to have part of the actor in phase 2, another part in phase 3, and the rest in phase 6, for instance. So you can set the actor's phase, and it will set all particles to that phase. There's no GetPhase() for actors tough, as often there's multiple phase values. Note you can both get and set phases per-particle using the particle API:
http://obi.virtualmethodstudio.com/tutor...icles.html

Unlike ObiActors, ObiColliders are not composed of smaller entities so the entire thing can only have one phase value.

2.- Mass should do the trick here: if the player mass is larger than the opponents, it should push them around easily. If there's no friction between them, they should slide on contact and the player would not "climb" on top, so in theory this should work. Could you share more details about this?

3.- Should not be needed to attach a collider to an actor, since particles already do collision detection/response.
Reply
#3
Thank you for the useful info!

Adjusting the mass won't do the trick though - massive player just squishes lighter opponents

Here are two videos.
Ground has all frictions set to 1 and combined friction is set to maximum
Both Player and the Sheep have all frictions set to 0 and minimum. 
Ship has 139 particles and Player has 50.

In the first video mass of every particle of the ship is set to 1. In the second one - to 0.1
Third video is a solid sphere collider attached as a child of a player. The desired effect I'm trying to achieve. If I make the sphere the size of the Player, with applied torque player stretches and sticks through the sphere. Making the sphere bigger looks unnatural. I might just end up painting it into a forcefield in the end and calling this a feature )

https://drive.google.com/drive/folders/1...sp=sharing

Setting collision material to None does nothing new.
Reply
#4
(22-03-2021, 12:01 PM)the-lander Wrote: Thank you for the useful info!

Adjusting the mass won't do the trick though - massive player just squishes lighter opponents

Here are two videos.
Ground has all frictions set to 1 and combined friction is set to maximum
Both Player and the Sheep have all frictions set to 0 and minimum. 
Ship has 139 particles and Player has 50.

In the first video mass of every particle of the ship is set to 1. In the second one - to 0.1
Third video is a solid sphere collider attached as a child of a player. The desired effect I'm trying to achieve. If I make the sphere the size of the Player, with applied torque player stretches and sticks through the sphere. Making the sphere bigger looks unnatural. I might just end up painting it into a forcefield in the end and calling this a feature )

https://drive.google.com/drive/folders/1...sp=sharing

Setting collision material to None does nothing new.

Could it be that particles from both softbodies are locking into each other (similar to gears?), and this allows the player to climb on top?.

You can tell if this is the case by using a ObiParticleRenderer to debug particles, then maybe going frame by frame to see what happens when they contact each other. *If* this is the case, increasing particle radius and/or allowing for more particle overlap will solve this. I can't think of any other reason for spherical softbodies to act like this in the absence of friction.
Reply
#5
Thank you. I'm writing to inform you tat the situation has improved, though I'm experiencing new issues:

- As I'm working on a mobile game I want to keep amount of particles at minimum. That's why I'm using a big spherical particles. Flat particles are working strange with some of them sticking at weird angles and my Players looks like limping. The problem with bigger particles is that now the sphere is not touching the floor. On your site I saw you've dealt with the similar issue for a cloth so now I'm searching this information. If there's no way to decrease the outer thickness of the Player without getting back the old issue I might just end up starting performance tests to determine how many particles are ok for an average mobile. 

- Another issue is that sometimes I generate a blueprint, bind the skin and after I run the game the object falls flat and looks like a spiked puddle. Tried creating new blueprint and reassigning and binding it but nothing helps. It looks like there's some kind of cache stored and only Unity restart helps. Or there's an error in the Obi code. Or an error in my DNA code, I don't know. I just might be tired after working on my company's game and then working on my own game. I'll sure post a video of this bug once our paths cross again.

Thank you for your support again )
Reply
#6
(24-03-2021, 08:54 PM)the-lander Wrote: Thank you. I'm writing to inform you tat the situation has improved, though I'm experiencing new issues:

- As I'm working on a mobile game I want to keep amount of particles at minimum. That's why I'm using a big spherical particles. Flat particles are working strange with some of them sticking at weird angles and my Players looks like limping. The problem with bigger particles is that now the sphere is not touching the floor. On your site I saw you've dealt with the similar issue for a cloth so now I'm searching this information. If there's no way to decrease the outer thickness of the Player without getting back the old issue I might just end up starting performance tests to determine how many particles are ok for an average mobile. 

If you want to increase particle thickness without introducing a "gap" between the player's surface and colliders (due to the larger particle radius), there's several ways to go about it: one is increasing shape smoothing in the blueprint, this will iteratively move particles to the average position of their neighbors. On most shapes, this has the effect of "shrinking" particle positions, making them sink into the surface of the mesh. Following this idea, another solution is to use different meshes for generating the blueprint and the skin: just use a smaller mesh to generate particles, then skin a bigger one around the resulting particles.

Another possible solution is compensate for the extra thickness by reducing all collider's thickness. However this is quite cumbersome and doesn't work well unless all the actors in your scene have roughly the same particle radius.

Can build examples of all three approaches if you wish.

(24-03-2021, 08:54 PM)the-lander Wrote: - Another issue is that sometimes I generate a blueprint, bind the skin and after I run the game the object falls flat and looks like a spiked puddle. Tried creating new blueprint and reassigning and binding it but nothing helps. It looks like there's some kind of cache stored and only Unity restart helps. Or there's an error in the Obi code. Or an error in my DNA code, I don't know. I just might be tired after working on my company's game and then working on my own game. I'll sure post a video of this bug once our paths cross again.

Thank you for your support again )

Sounds like:

- not large enough soft cluster radius, so some particles are not included in any shape matching cluster. (warned about in the manual: If parts of your softbody are detaching from it at runtime, it means your cluster network is fragmented. Use a larger soft cluster radius to ensure all clusters overlap with each other.)
- Forgot to re-bind the ObiSoftbodySkinner. Anytime the amount/position of particles in the softbody blueprint changes, you should re-bind the skin.

Either of these, or both at once can result in spiky puddles. Could be another reason ofc, but off the top of my head these are the best candidates Sonrisa
Reply
#7
That binding a blueprint with a smaller mesh on a bigger mesh does the trick, thank you!
Combined with Ice collision material and some mass adjustment I was able to make player move like a bowling pin through jelly pins.

Thank you again )
Reply