汽車腳本
『壹』 求一個汽車輪胎廣告創意腳本。
可以做一個FLASH的東西
『貳』 unity3d里的car腳本在哪裡
是官網的那個賽車的例子嗎?汽車上不是綁定了嗎?其實在工程窗口,直接搜cs或者js腳本類型,所有腳本都出來了...
『叄』 flash腳本翻譯 汽車顏色
先整體說一下,這個是AS2.0編寫的程序,舞台上有4個按鈕,每個按鈕點擊後會改變名為car_mc對象的顏色。
import flash.geom.ColorTransform;
//導入ColorTransform類,這個類在 flash.geom包中。
import flash.geom.Transform;
//類似上面語句
var colorTrans:ColorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
//新建一個名為colorTrans的ColorTransform 對象,因為一開始引入了這個類,所以可以不用再指定路徑,這條語句可以直接寫成:
var colorTrans:ColorTransform = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
參數的意義分別是(紅色乘數值、綠色乘數值、藍色乘數值、alpha透明度乘數值、紅色通道偏移量、綠色通道偏移量、藍色通道偏移量),這里的參數設置和默認值一摸一樣,表示,你以後給他賦有關顏色透明度的值的時候,賦什麼樣顯示的就是什麼樣,沒特別的效果。於是他可以進一步簡寫為:
var colorTrans:ColorTransform = new ColorTransform();
var trans:Transform = new flash.geom.Transform(car_mc);
//新建一個名為trans的Transform 對象,並附加到名為car_mc的影片剪輯。就是說以後改變trans,就會改變car_mc的transform 屬性。同樣因為一開始導入了這個類,可以直接寫作:
var trans:Transform = new Transform(car_mc);
trans.colorTransform = colorTrans;
//將創建好的colorTrans賦給trans的colorTransform屬性。但其實這條語句在這里沒什麼用,完全可以刪去。
blue_btn.onRelease = function(){
//給名為blue_btn的按鈕添加一個onRelease(點擊)事件,就是說點擊這個按鈕後會觸發這個事件,這個事件是什麼呢?就是{}里的、下面的這些語句。
colorTrans.rgb = 0x333399;
//給colorTrans的屬性rgb賦值,0x333399是16進制顯示的數,從0x後開始,每兩位分別表示:紅(r)、綠(g)、藍(b)。
trans.colorTransform = colorTrans;
//將更改過的colorTrans賦值給trans的colorTransform 屬性,因為前面附加過了,那麼car_mc的transform 屬性也被改變了,最後的結果就是car_mc的顏色變成了0x333399
};
//後面的都一樣,就不重復了哦
//最後,把簡略了點的程序貼上了~
import flash.geom.ColorTransform;
import flash.geom.Transform;
var colorTrans:ColorTransform = new ColorTransform();
var trans:Transform = new Transform(car_mc);
blue_btn.onRelease = function(){
colorTrans.rgb = 0x333399;
trans.colorTransform = colorTrans;
};
red_btn.onRelease = function() {
colorTrans.rgb = 0xFF0000;
trans.colorTransform = colorTrans;
};
black_btn.onRelease = function() {
colorTrans.rgb = 0x000000;
trans.colorTransform = colorTrans;
};
green_btn.onRelease = function() {
colorTrans.rgb = 0x006600;
trans.colorTransform = colorTrans;
};
『肆』 求由我世界汽車腳本
腳本都是自己編的
只要自己編出來什麼樣子的都可能,不違反規定和限制的都行,
不是很清楚你說的汽車腳本具體是做什麼的腳本
『伍』 以親情為主的汽車廣告腳本
一份從天而降的遺產打破了趙小宇簡單而快樂的生活,她的生活軌跡發生了天翻地覆的變化,特殊的身份招來了至愛親朋的非議和嫉妒,一群血緣相關的親人為了遺產猜忌爭斗。
『陸』 汽車腳本創作理念怎麼寫
摘要 親你好,我幫你用圖片表格的形式給你整理出來,希望你能滿意。
『柒』 求一段unity3D汽車自動駕駛的腳本代碼
1、把腳本直接連到汽車車身網格上,車身要有Rigidbody Component,要有四個輪子網格做子物體。 要想有聲音的話還要有AudioSource Component。
2、打開Inspector,選擇汽車腳本,把四個輪子連接到相對應的Transform參數上。設置wheelRadius參數為你輪子網格的大小。WheelCollider是自動生成的,所以無需手動添加。這樣就能保證運行了,其他的聲音和灰塵可以再添加。
腳本源代碼如下:*/
#pragma strict
//maximal corner and braking acceleration capabilities
var maxCornerAccel=10.0;
var maxBrakeAccel=10.0;
//center of gravity height - effects tilting in corners
var cogY = 0.0;
//engine powerband
var minRPM = 700;
var maxRPM = 6000;
//maximum Engine Torque
var maxTorque = 400;
//automatic transmission shift points
var shiftDownRPM = 2500;
var shiftUpRPM = 5500;
//gear ratios
var gearRatios = [-2.66, 2.66, 1.78, 1.30, 1.00];
var finalDriveRatio = 3.4;
//a basic handling modifier:
//1.0 understeer
//0.0 oversteer
var handlingTendency = 0.7;
//graphical wheel objects
var wheelFR : Transform;
var wheelFL : Transform;
var wheelBR : Transform;
var wheelBL : Transform;
//suspension setup
var suspensionDistance = 0.3;
var springs = 1000;
var dampers = 200;
var wheelRadius = 0.45;
//particle effect for ground st
var groundDustEffect : Transform;
private var queryUserInput = true;
private var engineRPM : float;
private var steerVelo = 0.0;
private var brake = 0.0;
private var handbrake = 0.0;
private var steer = 0.0;
private var motor = 0.0;
//private var skidTime = 0.0;
private var onGround = false;
private var cornerSlip = 0.0;
private var driveSlip = 0.0;
private var wheelRPM : float;
private var gear = 1;
//private var skidmarks : Skidmarks;
private var wheels : WheelData[];
private var wheelY = 0.0;
private var rev = 0.0;
//Functions to be used by external scripts
//controlling the car if required
//===================================================================
//return a status string for the vehicle
function GetStatus(gui : GUIText) {
gui.text="v="+(rigidbody.velocity.magnitude * 3.6).ToString("f1") km/h\ngear= "+gear+"\nrpm= "+engineRPM.ToString("f0");
}
//return an information string for the vehicle
function GetControlString(gui : GUIText) {
gui.text="Use arrow keys to control the jeep,\nspace for handbrake."; }
//Enable or disable user controls
function SetEnableUserInput(enableInput)
{
queryUserInput=enableInput;
}
//Car physics
//===================================================================
//some whee calculation data
class WheelData{ + "
var rotation = 0.0;
var coll : WheelCollider;
var graphic : Transform;
var maxSteerAngle = 0.0;
var lastSkidMark = -1;
var powered = false;
var handbraked = false;
var originalRotation : Quaternion;
};
function Start () {
//setup wheels
wheels=new WheelData[4];
for(i=0;i<4;i++)
wheels[i] = new WheelData();
wheels[0].graphic = wheelFL;
wheels[1].graphic = wheelFR;
wheels[2].graphic = wheelBL;
wheels[3].graphic = wheelBR;
wheels[0].maxSteerAngle=30.0;
wheels[1].maxSteerAngle=30.0;
wheels[2].powered=true;
wheels[3].powered=true;
wheels[2].handbraked=true;
wheels[3].handbraked=true;
for(w in wheels)
{
if(w.graphic==null)
Debug.Log("You need to assign all four wheels for the car script!"); if(!w.graphic.transform.IsChildOf(transform))
Debug.Log("Wheels need to be children of the Object with the car script");
w.originalRotation = w.graphic.localRotation;
//create collider
colliderObject = new GameObject("WheelCollider");
colliderObject.transform.parent = transform;
colliderObject.transform.position = w.graphic.position;
w.coll = colliderObject.AddComponent(WheelCollider);
w.coll.suspensionDistance = suspensionDistance;
w.coll.suspensionSpring.spring = springs;
w.coll.suspensionSpring.damper = dampers;
//no grip, as we simulate handling ourselves
w.coll.forwardFriction.stiffness = 0;
w.coll.sidewaysFriction.stiffness = 0;
w.coll.radius = wheelRadius;
}
//get wheel height (height forces are applied on)
wheelY=wheels[0].graphic.localPosition.y;
//setup center of gravity
rigidbody.centerOfMass.y = cogY;
//find skidmark object
// skidmarks = FindObjectOfType(typeof(Skidmarks));
//shift to first
gear=1;
}
//update wheel status
function UpdateWheels()
{
//calculate handbrake slip for traction gfx
handbrakeSlip=handbrake*rigidbody.velocity.magnitude*0.1;
if(handbrakeSlip>1)
handbrakeSlip=1;
totalSlip=0.0;
onGround=false;
for(w in wheels)
{
//rotate wheel
w.rotation += wheelRPM / 60.0 * -rev * 360.0 * Time.fixedDeltaTime; w.rotation = Mathf.Repeat(w.rotation, 360.0);
w.graphic.localRotation= Quaternion.Euler( w.rotation, w.maxSteerAngle*steer, 0.0 ) * w.originalRotation;
//check if wheel is on ground
if(w.coll.isGrounded)
onGround=true;
slip = cornerSlip+(w.powered?driveSlip:0.0)+(w.handbraked?handbrakeSlip:0.0); totalSlip += slip;
var hit : WheelHit;
var c : WheelCollider;
c = w.coll;
if(c.GetGroundHit(hit))
{
//if the wheel touches the ground, adjust graphical wheel position to reflect springs
w.graphic.localPosition.y-=Vector3.Dot(w.graphic.position-hit.point,transform.up)-w.coll.radius;
//create st on ground if appropiate
if(slip>0.5 && hit.collider.tag=="Dusty")
{
groundDustEffect.position=hit.point;
groundDustEffect.particleEmitter.worldVelocity=rigidbody.velocity*0.5; groundDustEffect.particleEmitter.minEmission=(slip-0.5)*3; groundDustEffect.particleEmitter.maxEmission=(slip-0.5)*3;
groundDustEffect.particleEmitter.Emit(); }
//and skid marks
/*if(slip>0.75 && skidmarks != null)
w.lastSkidMark=skidmarks.AddSkidMark(hit.point,hit.normal,(slip-0.75)*2,w.lastSkidMark);
else
w.lastSkidMark=-1; */
}
// else w.lastSkidMark=-1;
}
totalSlip/=wheels.length;
}
//Automatically shift gears
function AutomaticTransmission()
{
if(gear>0)
{
if(engineRPM>shiftUpRPM&&gear<gearRatios.length-1)
gear++;
if(engineRPM<shiftDownRPM&&gear>1)
gear--;
}
}
//Calculate engine acceleration force for current RPM and trottle
function CalcEngine() : float
{
if(brake+handbrake>0.;motor=0.0;;//ifcarisairborne,justre;if(!onGround);engineRPM+=(motor-0.3)*2;engineRPM=Mathf.Clamp(en;return0.0;;else;AutomaticTransmission();;engineRPM=whee
if(brake+handbrake>0.1)
motor=0.0;
//if car is airborne, just rev engine
if(!onGround)
{
engineRPM += (motor-0.3)*25000.0*Time.deltaTime;
engineRPM = Mathf.Clamp(engineRPM,minRPM,maxRPM);
return 0.0;
}
else
{
AutomaticTransmission();
engineRPM=wheelRPM*gearRatios[gear]*finalDriveRatio;
if(engineRPM<minRPM)
engineRPM=minRPM;
if(engineRPM<maxRPM)
{
//fake a basic torque curve
x = (2*(engineRPM/maxRPM)-1);
torqueCurve = 0.5*(-x*x+2);
torqueToForceRatio = gearRatios[gear]*finalDriveRatio/wheelRadius; return
motor*maxTorque*torqueCurve*torqueToForceRatio;
}
else
//rpm delimiter
return 0.0;
}
}
//Car physics
//The physics of this car are really a trial-and-error based extension of
//basic "Asteriods" physics -- so you will get a pretty arcade-like feel. //This
may or may not be what you want, for a more physical approach research //the
wheel colliders
function HandlePhysics () {
var velo=rigidbody.velocity;
wheelRPM=velo.magnitude*60.0*0.5;
rigidbody.angularVelocity=new
Vector3(rigidbody.angularVelocity.x,0.0,rigidbody.angularVelocity.z);
dir=transform.TransformDirection(Vector3.forward);
flatDir=Vector3.Normalize(new Vector3(dir.x,0,dir.z));
flatVelo=new Vector3(velo.x,0,velo.z);
rev=Mathf.Sign(Vector3.Dot(flatVelo,flatDir));
//when moving backwards or standing and brake is pressed, switch to
reverse
if((rev<0||flatVelo.sqrMagnitude<0.5)&&brake>0.1)
gear=0;
if(gear==0)
{
//when in reverse, flip brake and gas
tmp=brake;
brake=motor;
motor=tmp;
//when moving forward or standing and gas is pressed, switch to drive
if((rev>0||flatVelo.sqrMagnitude<0.5)&&brake>0.1)
gear=1;
}
engineForce=flatDir*CalcEngine();
totalbrake=brake+handbrake*0.5;
if(totalbrake>1.0)totalbrake=1.0;
brakeForce=-flatVelo.normalized*totalbrake*rigidbody.mass*maxBrakeAccel;
flatDir*=flatVelo.magnitude;
flatDir=Quaternion.AngleAxis(steer*30.0,Vector3.up)*flatDir;
flatDir*=rev;
diff=(flatVelo-flatDir).magnitude;
cornerAccel=maxCornerAccel;
if(cornerAccel>diff)cornerAccel=diff;
cornerForce=-(flatVelo-flatDir).normalized*cornerAccel*rigidbody.mass;
cornerSlip=Mathf.Pow(cornerAccel/maxCornerAccel,3);
rigidbody.AddForceAtPosition(brakeForce+engineForce+cornerForce,transform.position+transform.up*wheelY);
handbrakeFactor=1+handbrake*4;
if(rev<0)
handbrakeFactor=1;
veloSteer=((15/(2*velo.magnitude+1))+1)*handbrakeFactor;
steerGrip=(1-handlingTendency*cornerSlip);
if(rev*steer*steerVelo<0)
steerGrip=1;
maxRotSteer=2*Time.fixedDeltaTime*handbrakeFactor*steerGrip;
fVelo=velo.magnitude;
veloFactor=fVelo<1.0?fVelo:Mathf.Pow(velo.magnitude,0.3);
steerVeloInput=rev*steer*veloFactor*0.5*Time.fixedDeltaTime*handbrakeFactor;
if(velo.magnitude<0.1)
steerVeloInput=0;
if(steerVeloInput>steerVelo)
{
steerVelo+=0.02*Time.fixedDeltaTime*veloSteer;
if(steerVeloInput<steerVelo)
steerVelo=steerVeloInput;
}
else
{
steerVelo-=0.02*Time.fixedDeltaTime*veloSteer;
if(steerVeloInput>steerVelo)
steerVelo=steerVeloInput;
}
steerVelo=Mathf.Clamp(steerVelo,-maxRotSteer,maxRotSteer);
transform.Rotate(Vector3.up*steerVelo*57.295788);
}
function FixedUpdate () {
//query input axes if necessarry
if(queryUserInput)
{
brake = Mathf.Clamp01(-Input.GetAxis("Vertical"));
handbrake = Input.GetButton("Jump")?1.0:0.0;
steer = Input.GetAxis("Horizontal");
motor = Mathf.Clamp01(Input.GetAxis("Vertical"));
}
else
{
motor = 0;
steer = 0;
brake = 0;
handbrake = 0;
}
//if car is on ground calculate handling, otherwise just rev the engine
if(onGround)
HandlePhysics();
else
CalcEngine();
//wheel GFX
UpdateWheels();
//engine sounds
audio.pitch=0.5+0.2*motor+0.8*engineRPM/maxRPM;
audio.volume=0.5+0.8*motor+0.2*engineRPM/maxRPM;
}
//Called by DamageReceiver if boat destroyed
function Detonate()
{
//destroy wheels
for( w in wheels )
w.coll.gameObject.active=false; //no more car physics
enabled=false;
}
『捌』 各位大神 可否知道:http://www.qq.com/ 網頁右下彈出的大眾汽車廣告的腳本哪裡下載得到啊!
沒發現有大眾的廣告,
其實這些腳本,你可以直接查看網頁的源文件,,裡面就能找到
『玖』 Unity通過鍵盤控制汽車移動的腳本
privateGameObject_Car;
privatefloat_Speed=100;
voidStart(){
_Car=Instantiate(Resources.Load("實例化物體名"))asGameObject;
}
voidUpdate(){
if(Input.GetKeyDown(KeyCode.W))
{
_Car.transform.Translate(Vector3.forward*_Speed*Time.deltaTime);
}
if(Input.GetKeyDown(KeyCode.S))
{
_Car.transform.Translate(-Vector3.forward*_Speed*Time.deltaTime);
}
if(Input.GetKeyDown(KeyCode.A))
{
_Car.transform.Translate(Vector3.left*_Speed*Time.deltaTime);
}
if(Input.GetKeyDown(KeyCode.D))
{
_Car.transform.Translate(Vector3.right*_Speed*Time.deltaTime);
}
}
『拾』 觸摸精靈lua 賽車腳本幫忙修正
我搜了一下這個東西發現還挺有趣的~
我之前沒接觸過這個東西,也不知道你這個游戲是什麼游戲,所以我說的可能有點問題,LZ可以一起探討。
我覺得你這個邏輯可能有點小問題存在的。
你首先按下900ms然後松開,你是想讓車加速到一定時間對嗎?
然後現在開始了。首先你獲取了當前的狀態。然後比較這個狀態是否正確。
那麼第一個問題,這個狀態判斷我有些奇怪是什麼意思。照我看似乎是達到你需要的速度的狀態了?那麼應該松開,而不是加速吧?
然後用等於的簡單判斷讓我有點警惕,一般來說速度控制有兩種情況,超速、低速。這兩種情況可能應該需要一並考慮才比較合理。
我的想法有很多,但是不知道具體的需求,也不敢妄下結論,就先列出一個吧。
python">--@params:車當前狀態,true為加速,false為減速
functionrunning(s)
localstatus=s
--@paramspeed:1為超速,0為低速(我不知道是否有等於這個速度的情況,如果有請傳入1、0以外的速度)
returnfunction(speed)
ifspeed==1then--如果超速
ifstatusthen
status=false
touchUp(0)
end
elseifspeed==0then--如果慢速
ifnotstatusthen
status=true
touchDown(0,531,1518)
end
end
end
end
functionmain()
--前面照舊
whiletruethen
localcontrol=running(false)
localspeed=..經過你的判斷,它是超速還是慢速
control(speed)
sleep(500)--加入適當的延遲
end
end