Hey all,
FIRST: Crap I posted in the WRONG forum, lol, meant to go in BLITZ3D Programming. Sorry
Tinkering with some code, after butchering other code snipets I found post around here, and got a few questions to the smarter than the rest of us Guru's.
1 - Trying to find a way to make the next created quad start at the last created wuads vert position, in that they are all linked and not spaced out as seperate objects.
2 - If this method is functional enuff to be worth using.
3 - I created a poor mans method of trying to make the next created quad semi match the turn angle of the last, but because they "overlap" if you were to alpha them for better FX then you get that Overlayed darkening of any two quads made next to eachother. I assuming that a fix for problem #1 would resolve this.
Here's the Media used:

And the following Code:
Any input or corrections would be greatly welcomed and a relief.
Topknot ;)
FIRST: Crap I posted in the WRONG forum, lol, meant to go in BLITZ3D Programming. Sorry
Tinkering with some code, after butchering other code snipets I found post around here, and got a few questions to the smarter than the rest of us Guru's.
1 - Trying to find a way to make the next created quad start at the last created wuads vert position, in that they are all linked and not spaced out as seperate objects.
2 - If this method is functional enuff to be worth using.
3 - I created a poor mans method of trying to make the next created quad semi match the turn angle of the last, but because they "overlap" if you were to alpha them for better FX then you get that Overlayed darkening of any two quads made next to eachother. I assuming that a fix for problem #1 would resolve this.
Here's the Media used:

And the following Code:
Graphics3D 800,600,0,2 SetBuffer BackBuffer() AppTitle "Skidmark Testing" Global Speed# = 0 Global Yaw# = 0 Global TurnAngle# = 0 Global Move#, Turn# ClearTextureFilters() ; ################################################################################## Camera = CreateCamera() CameraClsColor Camera,130,130,130 ; ################################################################################## Light = CreateLight() AmbientLight 130,130,130 ; ################################################################################## Grid = CreateTexture(64,64,1+8) SetBuffer TextureBuffer(grid) Color 255,255,255 Rect 0 ,0 ,64,64 Color 255,0 ,0 Rect 0 ,0 ,64,64,False ScaleTexture grid,8,8 SetBuffer BackBuffer() ; ################################################################################## Floor = CreatePlane() EntityTexture Floor,grid MoveEntity Floor,0,0,0 ; ################################################################################## Global TrailTex = LoadTexture("SkidDirt.png",4) ; ################################################################################## Global DummyObject = CreateCube() ScaleEntity DummyObject,2,2,4 EntityColor DummyObject,100,100,250 Timer = CreateTimer(60) ; ################################################################################## ; # Main Loop # ; ################################################################################## While Not KeyHit(1) WaitTimer(Timer) UpdateKeys() Update_Camera(DummyObject,camera,10,5) Free_Skidmarks() RotateEntity DummyObject,0,turn,0 MoveEntity DummyObject,0,0,move If KeyHit(17) Then wframe = 1 - wframe WireFrame wframe UpdateWorld RenderWorld Text 0,10,"Tri's :"+TrisRendered() Text 0,20,"Speed# :"+Move# Flip Wend End ; ################################################################################## Type trail Field Mesh Field Surface Field FadeTime# Field Texture End Type ; ################################################################################## Function CreateSkid(segs#=2,parent=0,FadeTime#,Texture) Skidmark.trail = New Trail Skidmark\mesh = CreateMesh(parent) Skidmark\surface = CreateSurface(Skidmark\mesh) Skidmark\FadeTime# = FadeTime# Skidmark\Texture = Texture l# = -.5 b# = -.5 tvc = 1 ;create all the vertices first Repeat u# = l + .5 v# = b + .5 AddVertex Skidmark\surface,l,0,b,u,1-v tvc = tvc + 1 l = l + 1 / segs If l > .501 Then l = -.5 b = b + 1/segs End If Until b > .5 ;create polys vc# = 0 Repeat AddTriangle (Skidmark\surface,vc,vc+segs+1,vc+segs+2) AddTriangle (Skidmark\surface,vc,vc+segs+2,vc+1) vc = vc + 1 tst# = ((vc+1) /(segs+1)) -Floor ((vc+1) /(segs+1)) If (vc > 0) And (tst=0) Then vc = vc + 1 End If Until vc => tvc - segs - 2 UpdateNormals Skidmark\mesh EntityTexture Skidmark\mesh,Texture Return Skidmark\mesh End Function ; ################################################################################## Function Free_Skidmarks() For Skidmark.trail = Each trail Skidmark\FadeTime# = Skidmark\FadeTime# - 0.005 If Skidmark\FadeTime# < 0 FreeEntity Skidmark\mesh Delete skidmark EndIf Next End Function ; ################################################################################## Function Update_Camera(Character,Camera,Distance#,Hheight#,Angle=180) ;get player values px#=EntityX(character) py#=EntityY(character) pz#=EntityZ(character) pa#=EntityYaw(character)+angle ;get camera values cx#=EntityX(camera) cy#=EntityY(camera) cz#=EntityZ(camera) ;work out new values cx = curvevalue(cx,newxvalue(px,pa,distance),10) cy = curvevalue(cy,py+height,7) cz = curvevalue(cz,newzvalue(pz,pa,distance),10) ;update camera position PositionEntity camera,cx,cy,cz PointEntity camera,character ;EntityType camera,c_camera End Function ; ################################################################################## Function CurveValue#(current#,destination#,amount) current = current + ((destination - current) / amount) If current < 0.01 And current > - 0.01 Then current = 0 Return current End Function Function NewXValue#(current#,ang#,dist#) Return current-Sin(ang)*dist End Function Function NewYValue#(current#,ang#,dist#) Return current+Sin(ang)*dist End Function Function NewZValue#(current#,ang#,dist#) Return current+Cos(ang)*dist End Function ; ################################################################################## Function UpdateKeys() ;############################## ;### Movement Keys ### ;############################## If KeyDown(200) move# = move# + 0.1 Else Move# = move# - 0.01 EndIf If KeyDown(208) move# = move# - 0.1 EndIf If KeyDown(203) turn# = turn# + 8 Turnangle# = 2.5 EndIf If KeyDown(205) turn# = turn# - 8 Turnangle# = -2.5 EndIf If KeyDown(203) = 0 And KeyDown(205) = 0 Turnangle# = 0.0 EndIf If Move# > 5 Then Move# = 5 If Move# <= 0 Then Move# = 0.0 ;######################################## ;### Hit Left Space to Leave Skidmark ### ;######################################## If KeyDown(57) And move# > 0.5 box = CreateSkid(1,0,1,TrailTex) ScaleEntity box,2,2,2 Yaw# = EntityYaw#(DummyObject) PositionEntity box,EntityX(DummyObject), .1, EntityZ(DummyObject) RotateEntity box,0,Yaw# + Turnangle#,0 EntityFX box,2 EndIf End Function
Any input or corrections would be greatly welcomed and a relief.
Topknot ;)