Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
car-sim-remaster
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
9631059
car-sim-remaster
Commits
8da55d1e
Commit
8da55d1e
authored
Jun 22, 2020
by
Danial KordModanlou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some changes
parent
18810d82
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
325 additions
and
314 deletions
+325
-314
workspace.xml
.idea/.idea.car-sim-remaster/.idea/workspace.xml
+298
-304
IKD_VehicleController.cs
.../TurnTheGameOn/IK Driver/Scripts/IKD_VehicleController.cs
+26
-9
IKD_VehicleInput.cs
Assets/TurnTheGameOn/IK Driver/Scripts/IKD_VehicleInput.cs
+1
-1
No files found.
.idea/.idea.car-sim-remaster/.idea/workspace.xml
View file @
8da55d1e
This diff is collapsed.
Click to expand it.
Assets/TurnTheGameOn/IK Driver/Scripts/IKD_VehicleController.cs
View file @
8da55d1e
namespace
TurnTheGameOn.IKDriver
using
System
;
namespace
TurnTheGameOn.IKDriver
{
{
using
UnityEngine
;
using
UnityEngine
;
using
UnityEngine.UI
;
using
UnityEngine.UI
;
...
@@ -16,6 +18,8 @@
...
@@ -16,6 +18,8 @@
public KeyCode d5 = KeyCode.Joystick1Button12;
public KeyCode d5 = KeyCode.Joystick1Button12;
public KeyCode d6 = KeyCode.Joystick1Button13;
public KeyCode d6 = KeyCode.Joystick1Button13;
*/
*/
#
region
Public
Variables
#
region
Public
Variables
public
IKD_VehicleInput
vehicleInput
;
public
IKD_VehicleInput
vehicleInput
;
...
@@ -145,6 +149,7 @@
...
@@ -145,6 +149,7 @@
#
region
Utility
Methods
#
region
Utility
Methods
private
void
CapSpeed
()
private
void
CapSpeed
()
{
{
speed
=
rbody
.
velocity
.
magnitude
;
speed
=
rbody
.
velocity
.
magnitude
;
float
speedometerMultiplier
=
speedType
==
SpeedType
.
MPH
?
2.23693629f
:
speedType
==
SpeedType
.
KPH
?
3.6f
:
0f
;
float
speedometerMultiplier
=
speedType
==
SpeedType
.
MPH
?
2.23693629f
:
speedType
==
SpeedType
.
KPH
?
3.6f
:
0f
;
speed
*=
speedometerMultiplier
;
speed
*=
speedometerMultiplier
;
...
@@ -167,9 +172,14 @@
...
@@ -167,9 +172,14 @@
public
void
setGear
(
float
kelazh
)
public
void
setGear
(
float
kelazh
)
{
{
if
(
true
)
if
(
kelazh
>=
0.7f
)
{
{
if
(
Input
.
GetKey
(
KeyCode
.
JoystickButton8
))
if
(
Input
.
GetKeyUp
(
KeyCode
.
JoystickButton8
)
||
Input
.
GetKeyUp
(
KeyCode
.
JoystickButton9
)
||
Input
.
GetKeyUp
(
KeyCode
.
JoystickButton10
)
||
Input
.
GetKeyUp
(
KeyCode
.
JoystickButton11
)
||
Input
.
GetKeyUp
(
KeyCode
.
JoystickButton12
)
||
Input
.
GetKeyUp
(
KeyCode
.
JoystickButton13
))
{
currentGear
=
0
;
}
else
if
(
Input
.
GetKey
(
KeyCode
.
JoystickButton8
))
{
{
currentGear
=
1
;
currentGear
=
1
;
}
}
...
@@ -193,10 +203,6 @@
...
@@ -193,10 +203,6 @@
{
{
currentGear
=
-
1
;
currentGear
=
-
1
;
}
}
else
{
currentGear
=
0
;
}
//Debug.Log("curent : "+currentGear);
//Debug.Log("curent : "+currentGear);
}
}
}
}
...
@@ -227,7 +233,7 @@
...
@@ -227,7 +233,7 @@
}
}
else
else
{
{
//
setGear(kelazh);
setGear
(
kelazh
);
}
}
}
}
...
@@ -278,6 +284,8 @@
...
@@ -278,6 +284,8 @@
}
}
public
void
Move
(
float
clazh
,
float
steering
,
float
accel
,
float
footbrake
,
float
handbrake
){
public
void
Move
(
float
clazh
,
float
steering
,
float
accel
,
float
footbrake
,
float
handbrake
){
setPedalSoundSystem
(
accel
);
setPedalSoundSystem
(
accel
);
for
(
int
i
=
0
;
i
<
4
;
i
++){
for
(
int
i
=
0
;
i
<
4
;
i
++){
Quaternion
quat
;
Quaternion
quat
;
...
@@ -316,6 +324,9 @@
...
@@ -316,6 +324,9 @@
}
}
SteerHelper
();
SteerHelper
();
ApplyDrive
(
accel
,
footbrake
);
ApplyDrive
(
accel
,
footbrake
);
//Set the handbrake, Assuming that wheels 2 and 3 are the rear wheels.
//Set the handbrake, Assuming that wheels 2 and 3 are the rear wheels.
if
(
handbrake
>
0f
)
{
if
(
handbrake
>
0f
)
{
var
hbTorque
=
handbrake
*
maxHandbrakeTorque
;
var
hbTorque
=
handbrake
*
maxHandbrakeTorque
;
...
@@ -330,8 +341,13 @@
...
@@ -330,8 +341,13 @@
if
(
currentGear
==
-
1
)
if
(
currentGear
==
-
1
)
{
{
Debug
.
Log
(
"aghab"
);
Debug
.
Log
(
"aghab"
);
transform
.
Translate
(
transform
.
forward
*
-
1
*
accel
*
Time
.
fixedDeltaTime
*
2
);
//ApplyDrive(0, -1);
//transform.Rotate(0,0.1f * accel * Mathf.Lerp(-90,90,(steering + 1)/2)*Time.fixedDeltaTime,0);
transform
.
position
+=
transform
.
forward
*
-
1
*
accel
*
Time
.
fixedDeltaTime
*
2
;
rbody
.
velocity
=
Vector3
.
zero
;
return
;
return
;
//rbody.AddForce(-transform.forward*-1 * accel * Time.fixedDeltaTime*20000);
//return;
}
}
rbody
.
AddForce
(-
transform
.
up
*
downforce
*
rbody
.
velocity
.
magnitude
);
// Apply down force, used to add more grip in relation to speed
rbody
.
AddForce
(-
transform
.
up
*
downforce
*
rbody
.
velocity
.
magnitude
);
// Apply down force, used to add more grip in relation to speed
...
@@ -445,6 +461,7 @@
...
@@ -445,6 +461,7 @@
{
{
if
(
currentGear
==
-
1
)
// reverse
if
(
currentGear
==
-
1
)
// reverse
{
{
//CancelInvoke ("ResetGearCheck");
if
(
speed
<
topSpeedReverse
)
Reverse
(
footbrake
);
if
(
speed
<
topSpeedReverse
)
Reverse
(
footbrake
);
if
(
accel
>
0
)
ApplyBrake
(
accel
);
if
(
accel
>
0
)
ApplyBrake
(
accel
);
}
}
...
...
Assets/TurnTheGameOn/IK Driver/Scripts/IKD_VehicleInput.cs
View file @
8da55d1e
...
@@ -133,7 +133,7 @@ namespace TurnTheGameOn.IKDriver
...
@@ -133,7 +133,7 @@ namespace TurnTheGameOn.IKDriver
}
}
else
//setupd joystic
else
//setupd joystic
{
{
vehicleController
.
setGear
(
cluch
);
//
vehicleController.setGear(cluch);
}
}
}
}
else
{
else
{
...
...
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