fort Posted October 18, 2017 Share Posted October 18, 2017 I'm trying to create simple physics impostors for relatively complex models (to create CPU-friendly yet fairly accurate hitboxes). I noticed the scene.createCompoundImpostor method would likely work nicely for this sort of thing, but it was dropped in v3.0. What is the recommended strategy for v3.0? As an example, I'd like to create a hitbox for something like this: ...using an array of primitives, like this: edit: here's another example... Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 18, 2017 Share Posted October 18, 2017 Ping @RaananW Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 18, 2017 Share Posted October 18, 2017 Howdy! The old create compound method was removed since we changed the engine's architecture. I actually thought the function stayed deprecated, but hey - it's better to lose old unused functions The way to do compounds now is to use the parenting system. I don't see your images (I only see "Inline Image 1" as text), so I don't quite know what the use case is, but: 1. choose a parent, and connect the rest of the meshes with it. 2. set the impostors, starting from the children and ending with the parent. 3. run the scene! Here is a simple example: https://playground.babylonjs.com/#LMPPXZ Quote Link to comment Share on other sites More sharing options...
fort Posted October 18, 2017 Author Share Posted October 18, 2017 Thanks for the quick reply, @RaananW! I've updated the images in the OP—thinking those were critical in describing my particular issue. Would you mind giving it another look when you get a sec? I'm thinking I may be able to apply your approach by doing the following: Load in the "cabin" mesh Create the primitives used for the cabin's (the five, multicolored boxes) Use the cabin mesh as the parent for the boxes Set the physics impostors for the boxes Would that work? I'm basically trying to get a fairly accurate hitbox on the cabin without the processing cost of its out-of-the-box mesh impostor. Quote Link to comment Share on other sites More sharing options...
RaananW Posted October 20, 2017 Share Posted October 20, 2017 Hi fort, it all depends on the structure of your mesh. Alternatively, you could connect all meshes using a point-to-point joint (which is the same as creating a compound). This would actually be more stable, IMO. The "problem" with parenting existing meshes, is that their transformation will change as well. Meaning - you will need to reset their transformation after setting the parent (since they automatically get the parent's transformation) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.