Making a Fast Object Look Fast...Problem

About advanced scenes, and the Thyme scripting language used in Algodoo.

Making a Fast Object Look Fast...Problem

Postby stuff and stuff » Fri Jun 28, 2013 7:18 am

Well, I started making a train today (June 27, 2013) and I wanted it to be one of those really fast ones, like the Bullet Train in Japan. I got the neat idea of making the train blur as it got REALLY fast. So I came up with and used this code:
Code: Select all
(e)=>{
    e.this.edgeBlur = e.this.vel(0) / 500
}

Well, then I got a test car, code injected in all parts, and drove around, but in the first few instances of this testing, before the code was actually tested, I realized that this thing could go backwards...negative edge blur, which would look kind of...I don't know. Anyone know how to fix this to make it so that this code always gives a positive output? And any other ideas on how to make it look fast?
stuff and stuff
 
Posts: 4
Joined: Tue May 03, 2011 4:44 am

Re: Making a Fast Object Look Fast...Problem

Postby Ivan » Fri Jun 28, 2013 1:52 pm

You should apply this:
Code: Select all
(vel(0) < 0) ? {edgeBlur = -vel(0) / 500} : {edgeBlur = vel(0) / 500}

This is an if statement that says:
Code: Select all
If vel(0) is less than 0, edgeBlur = -vel(0) / 500 (to make it positive), else, edgeBlur = vel(0) / 500 without changing the sign.

To make it simpler, put this for the edgeBlur property of the train
Code: Select all
edgeBlur = { vel(0) < 0 ? -vel(0) / 500 : vel(0) / 500 }
User avatar
Ivan
 
Posts: 203
Joined: Tue Oct 06, 2009 2:01 pm
Location: Croatia

Re: Making a Fast Object Look Fast...Problem

Postby jon_joy_1999 » Sat Jul 20, 2013 10:43 am

doesn't edge blur blur the vertical as well as the horizontal edges? so what you'll end up with is an out of focus train?
Image
BSrac = BoincStats recent average credit
I'd rather be network computing.
jon_joy_1999
 
Posts: 233
Joined: Fri Dec 09, 2011 12:51 am


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests