Can CollisionShape be shared among physic spaces?

Java doc for CollisionShape indicates that a shape can be shared among multiple objects:

Does it hold true for multiple physic spaces? Can we share a CollisionShape among multiple collision objects in different physic spaces?

1 Like

i dont know, but it dont have any “changing on physics tick variables” so i think yes.

2 Likes

Sharing a CollisionShape instance between collision objects in different physics spaces ought to work. That’s how it’s designed.

2 Likes

Sharing a CollisionShape instance between collision objects in different physics spaces ought to work. That’s how it’s designed.

Okay, that’s good to know.
And in this case, I guess yet it would be safe to update PhysicSpaces in parallel, Yes? (To be exact, I mean using Java’s Parallel Stream API)

Like @oxplay2 said, collision shapes are read-only with respect to physics ticks. I don’t understand your concern.

1 Like

Not that this is the place for this discussion, but I’ve never personally found a viable use for parallel streaming. On the surface it sounds great but from what I know about it, it will introduce more problems than it solves. Parallel iterations will hog the entire CPU until it’s done, and in most cases manifest itself in random micro stutter and lockup’s. In a game or server I definitely don’t want that. I want a dedicated threadpool that isn’t affecting the Game Logic thread.

Anyway. I’m sidetracking.

1 Like