Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
天梦-黄聪鑫
/
RescureMenDemo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
70b92bde
authored
Jul 04, 2020
by
李楚霏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
研究马达关节
parent
860742c6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
32 deletions
+109
-32
rescureMen/assets/scene/test.fire
+70
-32
rescureMen/assets/script/gear.ts
+39
-0
No files found.
rescureMen/assets/scene/test.fire
View file @
70b92bde
...
...
@@ -84,13 +84,13 @@
"_active": true,
"_components": [
{
"__id__": 1
5
"__id__": 1
7
},
{
"__id__": 1
6
"__id__": 1
8
},
{
"__id__": 1
7
"__id__": 1
9
}
],
"_prefab": null,
...
...
@@ -180,7 +180,7 @@
"array": [
0,
0,
572.4427919015139
,
371.6221153255573
,
0,
0,
0,
...
...
@@ -351,6 +351,12 @@
},
{
"__id__": 10
},
{
"__id__": 15
},
{
"__id__": 16
}
],
"_prefab": null,
...
...
@@ -441,7 +447,7 @@
"__id__": 7
},
"_enabled": true,
"_type":
2
,
"_type":
1
,
"_allowSleep": true,
"_gravityScale": 1,
"_linearDamping": 0,
...
...
@@ -468,12 +474,12 @@
"_enabled": true,
"anchor": {
"__type__": "cc.Vec2",
"x":
29
,
"y": -3
9
"x":
1
,
"y": -3
1
},
"connectedAnchor": {
"__type__": "cc.Vec2",
"x": 3,
"x": 3
8
,
"y": 0
},
"connectedBody": {
...
...
@@ -482,12 +488,12 @@
"collideConnected": false,
"_linearOffset": {
"__type__": "cc.Vec2",
"x": 0,
"x":
3
0,
"y": 0
},
"_angularOffset": 0,
"_maxForce": 1,
"_maxTorque":
1
,
"_maxForce": 1
0
,
"_maxTorque":
200
,
"_correctionFactor": 0.3,
"_id": "40EQRA9TRE+rFRdgMnGLW8"
},
...
...
@@ -499,7 +505,7 @@
"__id__": 12
},
"_enabled": true,
"_type":
2
,
"_type":
1
,
"_allowSleep": true,
"_gravityScale": 1,
"_linearDamping": 0,
...
...
@@ -518,7 +524,7 @@
},
{
"__type__": "cc.Node",
"_name": "gear",
"_name": "gear
1
",
"_objFlags": 0,
"_parent": {
"__id__": 2
...
...
@@ -559,8 +565,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-
59.201
,
29.
6,
-
207.592
,
-92.12
6,
0,
0,
0,
...
...
@@ -617,37 +623,69 @@
"_id": "d899sMlPZKyrzwmjLmpXSy"
},
{
"__type__": "cc.
MotorJoint
",
"__type__": "cc.
PhysicsBoxCollider
",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 12
},
"_enabled": true,
"anchor": {
"__type__": "cc.Vec2",
"x": -30,
"y": -24
},
"connectedAnchor": {
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"connectedBody": {
"__id__": 9
"_size": {
"__type__": "cc.Size",
"width": 30,
"height": 30
},
"collideConnected": false,
"_linearOffset": {
"_id": "b1GoUkKj5DJZ6aJKJtsrcU"
},
{
"__type__": "cc.PhysicsBoxCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"x": 0
.6
,
"y": 0
},
"_angularOffset": 0,
"_maxForce": 1,
"_maxTorque": 1,
"_correctionFactor": 0.3,
"_id": "78Y9S/FiZMZr80gpkUwDx0"
"_size": {
"__type__": "cc.Size",
"width": 30,
"height": 30
},
"_id": "5fqfCs7LBL+IbOXJB113Tk"
},
{
"__type__": "f8d7b/0hj9IhpmWwu6imtTe",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"label": null,
"target": null,
"text": "hello",
"_id": "d5YHYCIbNEwI7HelCAj6Oc"
},
{
"__type__": "cc.Canvas",
...
...
rescureMen/assets/script/gear.ts
0 → 100644
View file @
70b92bde
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
NewClass
extends
cc
.
Component
{
@
property
(
cc
.
Label
)
label
:
cc
.
Label
=
null
;
@
property
target
:
cc
.
Node
=
null
;
@
property
text
:
string
=
'hello'
;
rigidBody
:
cc
.
RigidBody
;
motor
:
cc
.
MotorJoint
;
// LIFE-CYCLE CALLBACKS:
onLoad
()
{
this
.
rigidBody
=
this
.
node
.
getComponent
(
cc
.
RigidBody
);
this
.
motor
=
this
.
node
.
getComponent
(
cc
.
MotorJoint
);
this
.
motor
.
connectedBody
}
start
()
{
}
update
(
dt
)
{
// this.rigidBody.angularVelocity = 200;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment