[英]how to create a shape like this
I'm new in programing Java and I want to learn more. 我是Java编程的新手,我想学习更多。 I hear about
libgdx
and box2d
, and I want to play a bit with them, I want to create a field with an object that changes the gravity when the screen is touched. 我听到
libgdx
和box2d
,我想打了一下他们,我想创建一个字段,当屏幕被触摸时改变重力的对象。 My problem is the field, I want to implement something like this: 我的问题是领域,我想实现这样的事情:
But I don't know how this shape is called, to look over the internet, and how I should keep in memory this shape... 但是我不知道如何称呼这种形状,如何在互联网上浏览,以及如何记忆这种形状...
Can you give me some advices and examples, please? 请给我一些建议和例子吗? :)
:)
Shapes like those are called "Spline"s. 像这样的形状称为“样条线”。 There are several different kinds of those.
有几种不同的类型。
In Box2D terms you would create a Body with an Edge-Fixture and Box2D will then keep this shape itself, once it was created in the World. 用Box2D术语,您将创建一个具有Edge-Fixture的Body,一旦在World中创建了Box2D,Box2D将保留该形状。
I think you are probably trying to achieve some kind of "ground". 我认为您可能正在尝试实现某种“基础”。 So you might want to check out this article: http://www.iforce2d.net/blog/2013-07-20
所以您可能想看看这篇文章: http : //www.iforce2d.net/blog/2013-07-20
You can use ChainShape class in Box2D (or JBox2D ). 您可以在Box2D (或JBox2D )中使用ChainShape类。 Please take a look at this great resource: http://natureofcode.com/book/chapter-5-physics-libraries/
请看一下这个很棒的资源: http : //natureofcode.com/book/chapter-5-physics-libraries/
There is a part of using ChainShape class along with Vec2's which define Chain's points. 使用ChainShape类以及定义链点的Vec2的一部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.