• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java RopeJointDef类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.badlogic.gdx.physics.box2d.joints.RopeJointDef的典型用法代码示例。如果您正苦于以下问题:Java RopeJointDef类的具体用法?Java RopeJointDef怎么用?Java RopeJointDef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RopeJointDef类属于com.badlogic.gdx.physics.box2d.joints包,在下文中一共展示了RopeJointDef类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createRope

import com.badlogic.gdx.physics.box2d.joints.RopeJointDef; //导入依赖的package包/类
private void createRope(Body bodyA, Vector2 anchorA, Body bodyB, Vector2 anchorB, float sag, AtlasRegion ropeRegion)
{
    RopeJointDef jd = new RopeJointDef();
    jd.bodyA = bodyA;
    jd.bodyB = bodyB;
    jd.localAnchorA.set(anchorA.x, anchorA.y);
    jd.localAnchorB.set(anchorB.x, anchorB.y);	    
    // Max length of joint = current distance between bodies * sag
    float ropeLength =  bodyA.getWorldPoint(anchorA).sub(bodyB.getWorldPoint(anchorB)).len() * sag;
    jd.maxLength = ropeLength;
    
    // Create joint
    RopeJoint joint = (RopeJoint)world.createJoint(jd);
    GdxRopeJoint ropeJoint = new GdxRopeJoint(joint, jd.localAnchorA, jd.localAnchorB);
    
    VRope newRope = new VRope(ropeJoint, this, ropeRegion);
    
    ropes.add(newRope);
}
 
开发者ID:game-libgdx-unity,项目名称:GDX-Engine,代码行数:20,代码来源:Rope.java


示例2: JointSerializer

import com.badlogic.gdx.physics.box2d.joints.RopeJointDef; //导入依赖的package包/类
public JointSerializer(RubeScene scene,Json _json)
{
	this.scene = scene;
	_json.setSerializer(RevoluteJointDef.class, 	new RevoluteJointDefSerializer());
	_json.setSerializer(PrismaticJointDef.class, 	new PrismaticJointDefSerializer());
	_json.setSerializer(PulleyJointDef.class, 		new PulleyJointDefSerializer());
	_json.setSerializer(WeldJointDef.class, 		new WeldJointDefSerializer());
	_json.setSerializer(FrictionJointDef.class, 	new FrictionJointDefSerializer());
	_json.setSerializer(WheelJointDef.class, 		new WheelJointDefSerializer());
	_json.setSerializer(RopeJointDef.class, 		new RopeJointDefSerializer());
	_json.setSerializer(DistanceJointDef.class, 	new DistanceJointDefSerializer());
	_json.setSerializer(GearJointDef.class, 		new GearJointDefSerializer());
	
	mouseJointDefSerializer = new MouseJointDefSerializer();
	
	_json.setSerializer(MouseJointDef.class, 		mouseJointDefSerializer);
}
 
开发者ID:tescott,项目名称:RubeLoader,代码行数:18,代码来源:JointSerializer.java


示例3: read

import com.badlogic.gdx.physics.box2d.joints.RopeJointDef; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public RopeJointDef read(Json json, JsonValue jsonData, Class type)
{	
	RopeJointDef defaults = RubeDefaults.Joint.ropeDef;
	
	RopeJointDef def = new RopeJointDef();

	Vector2 anchorA 	= json.readValue("anchorA", Vector2.class, defaults.localAnchorA, jsonData);
	Vector2 anchorB 	= json.readValue("anchorB", Vector2.class, defaults.localAnchorB, jsonData);

	if(anchorA != null && anchorB != null)
	{
		def.localAnchorA.set(anchorA);
		def.localAnchorB.set(anchorB);
		def.maxLength 	= json.readValue("maxLength", 		float.class, 	defaults.maxLength, 		jsonData);
	}
	
	return def; 
}
 
开发者ID:tescott,项目名称:RubeLoader,代码行数:21,代码来源:JointSerializer.java


示例4: createRopeJoint

import com.badlogic.gdx.physics.box2d.joints.RopeJointDef; //导入依赖的package包/类
public Joint createRopeJoint(Body b1, Body b2, float maxLength)
{
	RopeJointDef rjd = new RopeJointDef();
	rjd.bodyA = b1;
	rjd.bodyB = b2;
	rjd.collideConnected = true;
	rjd.localAnchorA.set(Vector2.Zero);
	rjd.localAnchorB.set(Vector2.Zero);
	rjd.maxLength = maxLength;
	return world.createJoint(rjd);
}
 
开发者ID:ChainGangChase,项目名称:cgc-game,代码行数:12,代码来源:BodyFactory.java


示例5: ropeConnect

import com.badlogic.gdx.physics.box2d.joints.RopeJointDef; //导入依赖的package包/类
public void ropeConnect(PhysixBodyComponent a, PhysixBodyComponent b, float length) {
    RopeJointDef ropeJointDef = new RopeJointDef();
    ropeJointDef.bodyA = a.getBody();
    ropeJointDef.bodyB = b.getBody();
    ropeJointDef.maxLength = length * scaleInv;
    ropeJointDef.collideConnected = true;
    world.createJoint(ropeJointDef);
}
 
开发者ID:GameDevWeek,项目名称:CodeBase,代码行数:9,代码来源:PhysixSystem.java


示例6: setDefaults

import com.badlogic.gdx.physics.box2d.joints.RopeJointDef; //导入依赖的package包/类
/**
 * Set the defaults. The line will be drawn.
 */
@Override
protected void setDefaults()
{
	((RopeJointDef)jointDef).localAnchorA.set(new Vector2());
	((RopeJointDef)jointDef).localAnchorB.set(new Vector2());
	showLine = true;
}
 
开发者ID:flixel-gdx,项目名称:flixel-gdx-box2d,代码行数:11,代码来源:B2FlxRopeJoint.java


示例7: reset

import com.badlogic.gdx.physics.box2d.joints.RopeJointDef; //导入依赖的package包/类
@Override
public void reset() {
    jointDef = new RopeJointDef();

}
 
开发者ID:Rubentxu,项目名称:GDX-Logic-Bricks,代码行数:6,代码来源:RopeJointBuilder.java


示例8: setMaxLength

import com.badlogic.gdx.physics.box2d.joints.RopeJointDef; //导入依赖的package包/类
/**
 * The max length between the anchor points.
 */
public B2FlxRopeJoint setMaxLength(float maxLength)
{
	((RopeJointDef)jointDef).maxLength = maxLength;
	return this;
}
 
开发者ID:flixel-gdx,项目名称:flixel-gdx-box2d,代码行数:9,代码来源:B2FlxRopeJoint.java


示例9: setAnchorA

import com.badlogic.gdx.physics.box2d.joints.RopeJointDef; //导入依赖的package包/类
@Override
public B2FlxRopeJoint setAnchorA(Vector2 anchorA)
{		
	((RopeJointDef)jointDef).localAnchorA.set(anchorA);
	return this;
}
 
开发者ID:flixel-gdx,项目名称:flixel-gdx-box2d,代码行数:7,代码来源:B2FlxRopeJoint.java


示例10: setAnchorB

import com.badlogic.gdx.physics.box2d.joints.RopeJointDef; //导入依赖的package包/类
@Override
public B2FlxRopeJoint setAnchorB(Vector2 anchorB)
{
	((RopeJointDef)jointDef).localAnchorB.set(anchorB);
	return this;
}
 
开发者ID:flixel-gdx,项目名称:flixel-gdx-box2d,代码行数:7,代码来源:B2FlxRopeJoint.java


示例11: createProperJoint

import com.badlogic.gdx.physics.box2d.joints.RopeJointDef; //导入依赖的package包/类
private long createProperJoint(JointDef paramJointDef)
{
  if (paramJointDef.type == JointDef.JointType.DistanceJoint)
  {
    DistanceJointDef localDistanceJointDef = (DistanceJointDef)paramJointDef;
    return jniCreateDistanceJoint(this.addr, localDistanceJointDef.bodyA.addr, localDistanceJointDef.bodyB.addr, localDistanceJointDef.collideConnected, localDistanceJointDef.localAnchorA.x, localDistanceJointDef.localAnchorA.y, localDistanceJointDef.localAnchorB.x, localDistanceJointDef.localAnchorB.y, localDistanceJointDef.length, localDistanceJointDef.frequencyHz, localDistanceJointDef.dampingRatio);
  }
  if (paramJointDef.type == JointDef.JointType.FrictionJoint)
  {
    FrictionJointDef localFrictionJointDef = (FrictionJointDef)paramJointDef;
    return jniCreateFrictionJoint(this.addr, localFrictionJointDef.bodyA.addr, localFrictionJointDef.bodyB.addr, localFrictionJointDef.collideConnected, localFrictionJointDef.localAnchorA.x, localFrictionJointDef.localAnchorA.y, localFrictionJointDef.localAnchorB.x, localFrictionJointDef.localAnchorB.y, localFrictionJointDef.maxForce, localFrictionJointDef.maxTorque);
  }
  if (paramJointDef.type == JointDef.JointType.GearJoint)
  {
    GearJointDef localGearJointDef = (GearJointDef)paramJointDef;
    return jniCreateGearJoint(this.addr, localGearJointDef.bodyA.addr, localGearJointDef.bodyB.addr, localGearJointDef.collideConnected, localGearJointDef.joint1.addr, localGearJointDef.joint2.addr, localGearJointDef.ratio);
  }
  if (paramJointDef.type == JointDef.JointType.MouseJoint)
  {
    MouseJointDef localMouseJointDef = (MouseJointDef)paramJointDef;
    return jniCreateMouseJoint(this.addr, localMouseJointDef.bodyA.addr, localMouseJointDef.bodyB.addr, localMouseJointDef.collideConnected, localMouseJointDef.target.x, localMouseJointDef.target.y, localMouseJointDef.maxForce, localMouseJointDef.frequencyHz, localMouseJointDef.dampingRatio);
  }
  if (paramJointDef.type == JointDef.JointType.PrismaticJoint)
  {
    PrismaticJointDef localPrismaticJointDef = (PrismaticJointDef)paramJointDef;
    return jniCreatePrismaticJoint(this.addr, localPrismaticJointDef.bodyA.addr, localPrismaticJointDef.bodyB.addr, localPrismaticJointDef.collideConnected, localPrismaticJointDef.localAnchorA.x, localPrismaticJointDef.localAnchorA.y, localPrismaticJointDef.localAnchorB.x, localPrismaticJointDef.localAnchorB.y, localPrismaticJointDef.localAxisA.x, localPrismaticJointDef.localAxisA.y, localPrismaticJointDef.referenceAngle, localPrismaticJointDef.enableLimit, localPrismaticJointDef.lowerTranslation, localPrismaticJointDef.upperTranslation, localPrismaticJointDef.enableMotor, localPrismaticJointDef.maxMotorForce, localPrismaticJointDef.motorSpeed);
  }
  if (paramJointDef.type == JointDef.JointType.PulleyJoint)
  {
    PulleyJointDef localPulleyJointDef = (PulleyJointDef)paramJointDef;
    return jniCreatePulleyJoint(this.addr, localPulleyJointDef.bodyA.addr, localPulleyJointDef.bodyB.addr, localPulleyJointDef.collideConnected, localPulleyJointDef.groundAnchorA.x, localPulleyJointDef.groundAnchorA.y, localPulleyJointDef.groundAnchorB.x, localPulleyJointDef.groundAnchorB.y, localPulleyJointDef.localAnchorA.x, localPulleyJointDef.localAnchorA.y, localPulleyJointDef.localAnchorB.x, localPulleyJointDef.localAnchorB.y, localPulleyJointDef.lengthA, localPulleyJointDef.lengthB, localPulleyJointDef.ratio);
  }
  if (paramJointDef.type == JointDef.JointType.RevoluteJoint)
  {
    RevoluteJointDef localRevoluteJointDef = (RevoluteJointDef)paramJointDef;
    return jniCreateRevoluteJoint(this.addr, localRevoluteJointDef.bodyA.addr, localRevoluteJointDef.bodyB.addr, localRevoluteJointDef.collideConnected, localRevoluteJointDef.localAnchorA.x, localRevoluteJointDef.localAnchorA.y, localRevoluteJointDef.localAnchorB.x, localRevoluteJointDef.localAnchorB.y, localRevoluteJointDef.referenceAngle, localRevoluteJointDef.enableLimit, localRevoluteJointDef.lowerAngle, localRevoluteJointDef.upperAngle, localRevoluteJointDef.enableMotor, localRevoluteJointDef.motorSpeed, localRevoluteJointDef.maxMotorTorque);
  }
  if (paramJointDef.type == JointDef.JointType.WeldJoint)
  {
    WeldJointDef localWeldJointDef = (WeldJointDef)paramJointDef;
    return jniCreateWeldJoint(this.addr, localWeldJointDef.bodyA.addr, localWeldJointDef.bodyB.addr, localWeldJointDef.collideConnected, localWeldJointDef.localAnchorA.x, localWeldJointDef.localAnchorA.y, localWeldJointDef.localAnchorB.x, localWeldJointDef.localAnchorB.y, localWeldJointDef.referenceAngle);
  }
  if (paramJointDef.type == JointDef.JointType.RopeJoint)
  {
    RopeJointDef localRopeJointDef = (RopeJointDef)paramJointDef;
    return jniCreateRopeJoint(this.addr, localRopeJointDef.bodyA.addr, localRopeJointDef.bodyB.addr, localRopeJointDef.collideConnected, localRopeJointDef.localAnchorA.x, localRopeJointDef.localAnchorA.y, localRopeJointDef.localAnchorB.x, localRopeJointDef.localAnchorB.y, localRopeJointDef.maxLength);
  }
  if (paramJointDef.type == JointDef.JointType.WheelJoint)
  {
    WheelJointDef localWheelJointDef = (WheelJointDef)paramJointDef;
    return jniCreateWheelJoint(this.addr, localWheelJointDef.bodyA.addr, localWheelJointDef.bodyB.addr, localWheelJointDef.collideConnected, localWheelJointDef.localAnchorA.x, localWheelJointDef.localAnchorA.y, localWheelJointDef.localAnchorB.x, localWheelJointDef.localAnchorB.y, localWheelJointDef.localAxisA.x, localWheelJointDef.localAxisA.y, localWheelJointDef.enableMotor, localWheelJointDef.maxMotorTorque, localWheelJointDef.motorSpeed, localWheelJointDef.frequencyHz, localWheelJointDef.dampingRatio);
  }
  return 0L;
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:55,代码来源:World.java


示例12: B2FlxRopeJoint

import com.badlogic.gdx.physics.box2d.joints.RopeJointDef; //导入依赖的package包/类
/**
 * Create a rope joint.
 * @param spriteA	The first body.
 * @param spriteB	The second body.
 * @param jointDef	The joint definition.
 */
public B2FlxRopeJoint(B2FlxShape spriteA, B2FlxShape spriteB, RopeJointDef jointDef)
{
	super(spriteA, spriteB, jointDef);
}
 
开发者ID:flixel-gdx,项目名称:flixel-gdx-box2d,代码行数:11,代码来源:B2FlxRopeJoint.java



注:本文中的com.badlogic.gdx.physics.box2d.joints.RopeJointDef类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WorkbenchPart类代码示例发布时间:2022-05-22
下一篇:
Java KeyStoreUtil类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap