AS3 碰撞盒 + papervision3d +吉格利布
我正在尝试重新创建下面网站上解释的“教程”。场景中有 5 个骰子在弹跳。但我一开始就陷入困境:)
papervision3d -jiglib-dice-demo
我的问题是边界框。我想根据舞台的大小创建一个有地板和 4 壁的盒子。我可以使用相机上的变焦/聚焦来获得正确的尺寸。但问题是骰子会穿过它。
我如何建造 4 堵墙并确保当我对其施加力时骰子不会穿过它?
我尝试了以下源中的解决方案,但不知怎的,骰子继续通过:(
投掷骰子-with-the-jiglib-physical-engine-and-away3d
有人知道怎么做吗?或者有更好的方法让骰子保持在屏幕上?
I'm trying to recreate the "tutorial" explained on the site below. It's 5 dices bouncing around on the scene. But i'm stuck at the very beginning :)
papervision3d-jiglib-dice-demo
My problem is the bounding box. I want to create a box with a floor and 4 walls based on the size of the stage. I can get it the right size using zoom/focus on the camera. But the problem is the dices go through it.
How can i build 4 walls and make sure a dice doesnt go through it when i apply forces to it?
I tried the solution in the following source, but somehow the dices keep going through :(
throwing-dice-with-the-jiglib-physics-engine-and-away3d
Anybody knows how to do it? Or a better way to keep the dices on screen?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我解决了这个问题。只是与其他想要尝试相同的人分享:
// 现在场景宽度和高度与舞台的实际尺寸匹配。
添加所有面的平面,并确保使线段小于骰子的大小。 (例如:骰子大小 = 30;舞台宽度 = 300;段 = 舞台宽度/骰子大小 = 10)。
我将平面的高度设置得比骰子大小的两倍小,以确保它们永远不会相互重叠。
最后通过将另一个具有小段的平面放置在其他平面的顶部来添加天花板
I solved the problem. Just to share with others who want to try the same:
// now the scene width and height match the actual size of the stage.
add the planes for all sides and make sure you make the segments smaller then the dice size. (EG: dice size = 30; stage width = 300; segments = stage width/ dice size = 10).
I made the height of the planes a little smaller then twice the dice size to make sure they never get on top of eachother.
And finally add a ceiling by placing another plane with small segments on top of the other planes