资源简介
源码可使用unity打开,一个赛车游戏。
代码片段和文件信息
/**
* A simple car physics script using wheel colliders.
* Jaap Kreijkamp jaap@ctrl-j.com.au
*
* orientation should be that front of car is in direction of
* the ‘blue arrow‘ in Unity the roof should be in direction of
* the green angle. Thus with rotation 0 0 0 adding 1 to Z
* will move car 1m forward adding 1 to Y will move car 1m
* upward. The wheels should be children of the car object this
* script is added to and connected to the wheelFL wheelFR ...
* variables.
*
* Please modify script and do whatever you like with it
* in it‘s current state it should give a working car
* but by no means perfect (or even close) behavior.
* It‘s my first attempt and don‘t really need in my current
* project so haven‘t put too much effort into it to perfect
* it. As often people are looking for help to getting
* a car working with wheel colliders I‘d appreciate when
* improvements are posted back on the unity forums.
*
* Lastly thanks to all the people helping me on forums (especially
* the order of initialisation problem and other example
* code that helped me much in learning how to do stuff like
* this).
*/
using UnityEngine;
using System.Collections;
// used to indicate if car is frontwheeldrive backwheeldrive or 4wheeldrive
// also (mis)used to indicate if a wheel is a front wheel or a back wheel
public enum JWheelType {
Front = 1
Back = 2
All = 3
}
public class JCar : MonoBehaviour {
// if connected the controls will block if object not active
// (for example steer only if car camera is active).
public Gameobject checkForActive;
// if set car records position accel ... data every time
// handle motor is called.
public JRecordRoute recordRoute;
// returns current speed in Km/H
public float CurrentSpeed {
get { return rigidbody.velocity.magnitude * 3.6f; }
}
public int CurrentGear {
get { return currentGear; }
}
public float MotorRPM {
get { return motorRPM; }
}
public bool MotorRunning {
get { return audioSource.isPlaying; }
}
public float TotalDistance {
get { return totaldist; }
}
public Transform wheelFR; // connect to Front Right Wheel transform
public Transform wheelFL; // connect to Front Left Wheel transform
public Transform wheelBR; // connect to Back Right Wheel transform
public Transform wheelBL; // connect to Back Left Wheel transform
// power curves (power1 is for gear 1 and reverse!)
// horizontal axis is RPM
// vertical axis is power where 5000f equals to 100%
// (you can go over 5000f if you want but for easier tuning it‘s probably
// better to adjust the torque parameter and keep the curve below 5000f.)
// the default values are totally useless so you have to edit the curves
// you can do this by adding CurveEditor.cs and ResponseCurveEditor.cs to
// your project (in Editor directory of JCar or in the Animation-API example).
// the best way to set curves is steep increase with top at 2000RPM then
// slow decrease back to 0 at h
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-02-26 18:13 Unity3D开发的简单赛车游戏\
目录 0 2019-02-26 18:21 Unity3D开发的简单赛车游戏\greenCar\
文件 6148 2008-08-21 09:20 Unity3D开发的简单赛车游戏\greenCar\.DS_Store
目录 0 2019-02-26 18:15 Unity3D开发的简单赛车游戏\greenCar\Assets\
文件 6148 2008-08-14 15:32 Unity3D开发的简单赛车游戏\greenCar\Assets\.DS_Store
目录 0 2019-02-26 18:15 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\
文件 6148 2008-08-17 15:58 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\.DS_Store
文件 28689 2008-08-20 13:32 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Car.jas
文件 2035 2019-02-26 18:15 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Car.jas.me
文件 107411 2008-08-12 12:17 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Car.png
文件 1430 2019-02-26 18:15 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Car.png.me
文件 7299 2008-08-19 21:33 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\DirectionDisplay.jas
文件 1874 2019-02-26 18:15 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\DirectionDisplay.jas.me
目录 0 2019-02-26 18:15 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Materials\
文件 3654 2008-08-14 15:29 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Materials\Car Black Color.mat
文件 161 2019-02-26 18:15 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Materials\Car Black Color.mat.me
文件 3727 2008-08-14 16:53 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Materials\Car.mat
文件 161 2019-02-26 18:15 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Materials\Car.mat.me
文件 3654 2008-08-14 20:36 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Materials\GhostCar Black Color.mat
文件 161 2019-02-26 18:15 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Materials\GhostCar Black Color.mat.me
文件 3735 2008-08-14 16:55 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Materials\GhostCar.mat
文件 161 2019-02-26 18:15 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Materials\GhostCar.mat.me
文件 3646 2008-08-20 14:32 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Materials\car-b h 01.mat
文件 161 2019-02-26 18:15 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Materials\car-b h 01.mat.me
文件 3809 2008-08-12 16:14 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Materials\dials.mat
文件 161 2019-02-26 18:15 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Materials\dials.mat.me
文件 3646 2008-08-12 16:15 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Materials\speedometer.mat
文件 161 2019-02-26 18:15 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Materials\speedometer.mat.me
文件 150 2019-02-26 18:15 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\Materials.me
文件 48106 2008-08-19 14:03 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\RPM.jas
文件 1948 2019-02-26 18:15 Unity3D开发的简单赛车游戏\greenCar\Assets\Car\RPM.jas.me
............此处省略1016个文件信息
相关资源
- 调查问卷网站源码
- Unity3D上传图片以及解析二进制流
- Infragistics_Ultimate_2017
- CRM客户关系管理系统源码+文档
-
Open xm
l 操作powerpoint - UNITY3d人物模型+动作
- npoi.2.5.1
- Unity3D官方赛车资源包
- Unity3D 之2d开发,飞机大战所有源代码
- SharpGL测试范例
- Unity3D游戏开发流程与规范.ppt
- 贷款管理系统
- 完整的人事管理系统需求分析,详细
- WCF服务实现用户登陆和添加、查询用
- Unity3d适合移动端的景深DOF效果
- 医院门诊管理系统源码
- Unity3DPatch_5.6.x.zip
- unity3d游戏框架消息机制
- Pocket+RPG+Weapon+Trails+武器拖尾效果(
- Unity3D挥剑(剑痕特效)
- .NET 车站售票系统
- 进销存用户需求说明书用例图的描述
- 宿舍管理信息系统源码
- itext7 dotnet 7
- 汉王ESP370U驱动及DEMO
- arcgis engine新建图层添加坐标系地理坐
- UDP局域网连接
- 酒店客房管理源码
- 数据库 公司人事管理系统源代码+报告
- Unity3D 虚拟手DEMO
评论
共有 条评论