Skip to content
Snippets Groups Projects
Commit 67712ee8 authored by Vesa Lappalainen's avatar Vesa Lappalainen :bicyclist:
Browse files

live 17 alku

parent 8653739f
No related branches found
No related tags found
No related merge requests found
......@@ -179,7 +179,7 @@ public class Hirsipuu : PhysicsGame
/// </summary>
public class Hirsi : PhysicsObject
{
/*
public class AxleJoint : Jypeli.AxleJoint
{
......@@ -236,7 +236,7 @@ public class Hirsi : PhysicsObject
}
*/
private static readonly Image Kuva = Game.LoadImage("puupalikka");
......
......@@ -8,8 +8,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Jypeli.NET" Version="10.*" />
<PackageReference Include="Jypeli.FarseerPhysics.NET" Version="1.0.*" />
<PackageReference Include="Jypeli.NET" Version="10.1.6" />
<PackageReference Include="Jypeli.FarseerPhysics.NET" Version="1.0.11" />
</ItemGroup>
<ItemGroup>
<None Update="Content\jalka.png">
......
......@@ -7,68 +7,9 @@ using Jypeli.Farseer;
public class Liitos : PhysicsGame
{
public class AxleJoint : Jypeli.AxleJoint
{
internal FSJoint InnerJoint
{
get
{
return (FSJoint)innerJoint;
}
set
{
innerJoint = value;
}
}
/// <summary>
/// Tällä voi säätää näytetäänkö liitospisteet
/// </summary>
public static bool DrawJointPoints { set; get; }
/// <summary>
/// Luo uuden akseliliitoksen kahden olion välille.
/// </summary>
/// <param name="firstObject">Ensimmäinen olio</param>
/// <param name="secondObject">Toinen olio</param>
/// <param name="axlePosition">Liitoksen akselin paikka</param>
public AxleJoint(PhysicsObject firstObject, PhysicsObject secondObject, Vector axlePosition)
: base(firstObject, secondObject, axlePosition)
{
World world = PhysicsGame.Instance.Engine as World;
var first = firstObject.Body as PhysicsBody;
var second = secondObject.Body as PhysicsBody;
var ap2 = firstObject.Position + axlePosition - secondObject.Position;
InnerJoint = JointFactory.CreateDistanceJoint(world,
first.FSBody, second.FSBody,
axlePosition * FSConvert.DisplayToSim, ap2 * FSConvert.DisplayToSim);
// axlePosition2 * FSConvert.DisplayToSim);
InnerJoint.DampingRatio = 0.5f;
InnerJoint.Frequency = 50;
if (!DrawJointPoints) return;
var dot = new GameObject(15, 15, Shape.Circle);
dot.Color = Color.Red;
dot.Position = firstObject.Position + axlePosition;
firstObject.Add(dot);
dot = new GameObject(10, 10, Shape.Circle);
dot.Color = Color.Green;
dot.Position = secondObject.Position + ap2;
secondObject.Add(dot);
//InnerJoint.Enabled = false;
}
}
public override void Begin()
{
AxleJoint.DrawJointPoints = true;
// AxleJoint.DrawJointPoints = true;
Level.Background.Color = Color.Black;
var osa1 = new PhysicsObject(200, 30);
osa1.MakeStatic();
......
......@@ -8,8 +8,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Jypeli.NET" Version="10.*" />
<PackageReference Include="Jypeli.FarseerPhysics.NET" Version="1.0.*" />
<PackageReference Include="Jypeli.NET" Version="10.1.6" />
<PackageReference Include="Jypeli.FarseerPhysics.NET" Version="1.0.11" />
</ItemGroup>
</Project>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment