changeing texture every step?

hey i was just wondering if any one has any idears on how i could make it so everytime i take a step the texture changes,the script controlles a plane with a texture of a sprite on it. hear is the movement script thanks in advance :slight_smile:
#pragma strict

@script RequireComponent( CharacterController )

var moveTouchPad : Joystick;

var forwardSpeed : float = 4;
var textureNum : int = 0;

private var thisTransform : Transform;
private var character : CharacterController;

function Start()
{

thisTransform = GetComponent( Transform );
character = GetComponent( CharacterController );

var spawn = GameObject.Find( “PlayerSpawn” );
if ( spawn )
thisTransform.position = spawn.transform.position;
}

function OnEndGame()
{

moveTouchPad.Disable();

this.enabled = false;
}

function Update()
{
var movement = thisTransform.TransformDirection( Vector3( moveTouchPad.position.x, 0, moveTouchPad.position.y ) );

movement.y = 0;
movement.Normalize();

var absJoyPos = Vector2( Mathf.Abs( moveTouchPad.position.x ), Mathf.Abs( moveTouchPad.position.y ) );
if ( absJoyPos.y >= absJoyPos.x )
{
if ( moveTouchPad.position.y > 0 )
{
movement = Vector3.forward * forwardSpeed * Time.deltaTime;
guiText.text = “texture:”+ textureNum;
textureNum ++;
guiText.text = “texture:”+ textureNum;
textureNum --;
guiText.text = “texture:”+ textureNum;
}
else if ( moveTouchPad.position.y < 0 )
{
movement = -Vector3.forward * forwardSpeed * Time.deltaTime;
}
}
else if ( absJoyPos.x > absJoyPos.y )
{
if ( moveTouchPad.position.x > 0 )
{
movement = Vector3.right * forwardSpeed * Time.deltaTime;
}
else if ( moveTouchPad.position.x < 0 )
{
movement = Vector3.left * forwardSpeed * Time.deltaTime;
}
}
character.Move( movement );
}

I suppose you want to add some foot prints every time the player performs a step. Anyway, there are few solutions to your problem.

One could be making a decal texture every time the foot touches the floor (by simply adding a collider to both feed).

Or you can just simply calculate the rate of steps that the player performs in a second and add a decal on the floor relative to the player’s position.

I’ve never done this before, so there may be is a better way to do this

thanks for your help :slight_smile: im actualy making a rpg with graphics abit like pokemon dimond and pearl(and everyone that came after those 2) in a sence that it has a 2d sprite in a 3d world, my plan was to use this:

if (Time.deltaTime / forwardSpeed)
{
//rendering stuff hear
guiText.text = “texture walk”;
}
else
{
// other rendering stuff
guiText.text = “texture idle”;
}
but it dosent work so if anyone has anyidears it would be greatly apreciated :slight_smile: