本篇文章给大家谈谈如何用python制作游戏,以及利用python制作小游戏,希望对各位有所帮助,不要忘了收藏本站喔。
大家好,小编来为大家解答以下问题,如何用python制作游戏,利用python制作小游戏,现在让我们一起来看看吧!
2019独角兽企业重金招聘Python工程师标准>>>
该组件是用来描述轮胎的(比如扭矩 转速等等),可用来附加在赛车游戏 的车轮上
A special collider for vehicle wheels.
Wheel collider is used to model vehicle wheels. It simulates a spring and damper suspension setup, and uses a slip based tire friction model to calculate wheel contact forces. Wheel's collision detection is performed by casting a ray from center downwards the local y-axis. The wheel has a radius and can extend downwards by suspensionDistance amount. The wheel is controlled with motorTorque, brakeTorque and steerAngle properties. Wheel collider computes friction separately from the rest of physics engine, using a slip based friction model. This allows for more realistic behaviour, but makes wheel colliders ignore standard PhysicMaterial settings. Simulation of different road materials is done by changing the forwardFriction and sidewaysFriction based on what material the wheel is hitting. See Also: GetGroundHit and WheelFrictionCurve. -----------------------来自 Scripting API
3个 应用例子
1.通过扭矩来使车加速
GetComponent<WheelCollider>().motorTorque = Input.GetAxis("Vertical") * 25000 * Time.deltaTime;
2.通过steer 来控制汽车转弯
float delta= Input.GetAxis("Horizontal");
GetComponent<WheelCollider>().steerAngle = 20 * delta;
3.通过localRotation控制汽车转弯
float delta= Input.GetAxis("Horizontal");
transform.localRotation = Quaternion.Euler(transform.localRotation.x, 30 * delta, 0);
转载于
原文地址:https://blog.csdn.net/2301_81896552/article/details/136696820