Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
esimerkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tie
ohj1
2021s
esimerkit
Commits
cd1947f3
Commit
cd1947f3
authored
3 years ago
by
Vesa Lappalainen
Browse files
Options
Downloads
Patches
Plain Diff
liitospisteet merkitty
parent
0e1eacdc
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
luennot/luento17/Hirsipuu/Hirsipuu.cs
+14
-2
14 additions, 2 deletions
luennot/luento17/Hirsipuu/Hirsipuu.cs
luennot/luento17/Liitos/Liitos.cs
+5
-1
5 additions, 1 deletion
luennot/luento17/Liitos/Liitos.cs
with
19 additions
and
3 deletions
luennot/luento17/Hirsipuu/Hirsipuu.cs
+
14
−
2
View file @
cd1947f3
...
...
@@ -191,6 +191,12 @@ public class Hirsi : PhysicsObject
}
/// <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>
/// <summary>
/// Luo uuden akseliliitoksen kahden olion välille.
/// </summary>
...
...
@@ -210,13 +216,19 @@ public class Hirsi : PhysicsObject
// axlePosition2 * FSConvert.DisplayToSim);
InnerJoint
.
DampingRatio
=
0.5f
;
InnerJoint
.
Frequency
=
50
;
var
dot
=
new
GameObject
(
20
,
20
,
Shape
.
Circle
);
dot
.
Color
=
Color
.
Red
;
dot
.
Position
=
firstObject
.
Position
+
axlePosition
;
firstObject
.
Add
(
dot
);
//InnerJoint.Enabled = false;
}
}
private
static
readonly
Image
Kuva
=
Game
.
LoadImage
(
"puupalikka"
);
private
static
readonly
Image
Kuva
=
Game
.
LoadImage
(
"puupalikka"
);
private
readonly
PhysicsGame
peli
;
private
readonly
IntMeter
palikoita
=
new
IntMeter
(
0
);
private
readonly
PhysicsObject
taso
;
...
...
@@ -303,7 +315,7 @@ public class Hirsi : PhysicsObject
PhysicsObject
oikeaKasi
=
LuoOlio
(
peli
,
paa
.
Position
+
new
Vector
(-
50
+
-
65
,
-
20
),
150
,
40
,
Game
.
LoadImage
(
"kasi"
));
oikeaKasi
.
Angle
=
Angle
.
FromDegrees
(
180
);
peli
.
Add
(
new
AxleJoint
(
torso
,
oikeaKasi
,
new
Vector
(-
torso
.
Width
/
2
,
-
torso
.
Height
/
2
)));
peli
.
Add
(
new
AxleJoint
(
torso
,
oikeaKasi
,
new
Vector
(-
torso
.
Width
/
2
,
torso
.
Height
/
2
)));
PhysicsObject
vasenJalka
=
LuoOlio
(
peli
,
torso
.
Position
+
new
Vector
(
40
,
-
110
-
75
),
75
,
190
,
Game
.
LoadImage
(
"jalka"
));
peli
.
Add
(
new
AxleJoint
(
vasenJalka
,
torso
,
new
Vector
(
0
,
vasenJalka
.
Height
)));
...
...
This diff is collapsed.
Click to expand it.
luennot/luento17/Liitos/Liitos.cs
+
5
−
1
View file @
cd1947f3
...
...
@@ -44,6 +44,10 @@ public class Liitos : PhysicsGame
// axlePosition2 * FSConvert.DisplayToSim);
InnerJoint
.
DampingRatio
=
0.5f
;
InnerJoint
.
Frequency
=
50
;
var
dot
=
new
GameObject
(
20
,
20
,
Shape
.
Circle
);
dot
.
Color
=
Color
.
Red
;
dot
.
Position
=
firstObject
.
Position
+
axlePosition
;
firstObject
.
Add
(
dot
);
//InnerJoint.Enabled = false;
}
...
...
@@ -63,7 +67,7 @@ public class Liitos : PhysicsGame
osa2
.
AddCollisionIgnoreGroup
(
1
);
Add
(
osa2
);
var
liitos
=
new
AxleJoint
(
osa1
,
osa2
,
new
Vector
(
osa1
.
Width
/
2
,
0
));
liitos
.
Softness
=
0
;
//
liitos.Softness = 0;
Add
(
liitos
);
var
osa3
=
new
PhysicsObject
(
200
,
30
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment