Drawing/Skidmarks

Software: Away3D 4.x

macaan, Newbie
Posted: 16 August 2012 02:15 PM   Total Posts: 30

Hi there,
i’m again trying to do some skidmarks. The way i tried is the following:

private function drawWithWheels():void
  {
var uvPoint1:Point = new Point((wheelRl.raycastInfo.contactPointWS.x+10000)*(1/20000), (22000-(wheelRl.raycastInfo.contactPointWS.z+11000))*(1/22000)); 

var 
uvPoint2:Point = new Point((wheelRr.raycastInfo.contactPointWS.x+10000)*(1/20000), (22000-(wheelRr.raycastInfo.contactPointWS.z+11000))*(1/22000)); 
          
var 
tex:BitmapTexture texture
var 
oldData:BitmapData tex.bitmapData;   
var 
newData:BitmapData oldData.clone();  
uvPoint1.*= newData.width;     
uvPoint1.*= newData.height;

uvPoint2.*= newData.width;    
uvPoint2.*= newData.height;

  
newData.copyPixels(mSkidmSkid.rectuvPoint1);  
newData.copyPixels(mSkidmSkid.rectuvPoint2);  
tex.bitmapData newData;     
oldData.dispose();  
  

But with this way you always have to change the texture and that isn’t good for speed.
Other ways i think about is trying to write an own shader for this or using flat meshes to put on the road.
What do you think is the best way to do skidmarks? I even got problems withe the UV’s, these method works fine on a plane, but not on a curved road with repeating UV’s

Thanks for answering

   

Richard Olsson, Administrator
Posted: 27 August 2012 09:33 AM   Total Posts: 1192   [ # 1 ]

I would guess that the best way would be to create geometry rather than to affect the actual surface of the ground. So overlaying a geometry right on top of the ground is what I would try first.

   

macaan, Newbie
Posted: 27 August 2012 05:23 PM   Total Posts: 30   [ # 2 ]

thanks, i had a few attempts on this but i think i did something wrong. I think i have to build a mesh and add clones of the mesh.geometry as subgeometries.
Never worked on this, if i’m right i have to directly set the buffers etc. I try it and let you know.

here is a small demo of the above mentioned way. its done with the smallest possible texture resolution, everything smaller than 256x256 results in too big dots and looks terrible

steering with arrow keys, space to brake
http://labs.addedtostage.de/skids/

   

macaan, Newbie
Posted: 24 September 2012 09:12 AM   Total Posts: 30   [ # 3 ]

I now got some solution working using the FaceHelper Class.

here it is, you can switch the method by clicking the buttons on top.

steering with arrow keys, space to brake
http://labs.addedtostage.de/skids/

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X