Moving Fx Question.

   4069   6   0
User Avatar
Member
84 posts
Joined: Aug. 2008
Offline
It is a question about moving fx.

Let's look a script in Flash ActionScript 2.0:
***
onClipEvent (load) {
var speed:Number;
var Xpos:Number = 5;
this._x=0
}
onClipEvent (enterFrame) {
speed = (Xpos-this._x)*0.1;
this._x += speed;
}
***

Now, I create a box and try to re-write this ActionScript in Houdini.

How to set it in Houdini?

How to make variables calculate every single frame?

speed should be changed every frame, and fix object's x position every frame,too.

If you have any question about this, please point it out.

Let me fix it ASAP.

Thanks!

Attachments:
sample.rar (593 bytes)
MovingFx.hip (46.7 KB)

https://vimeo.com/jacyslin [vimeo.com]
User Avatar
Member
311 posts
Joined: July 2005
Offline
Not being up on ActionScript, what exactly are you trying to acheive?
User Avatar
Member
84 posts
Joined: Aug. 2008
Offline
I dont mean to write AS on houdini.

I mean use the same concept to make it!
https://vimeo.com/jacyslin [vimeo.com]
User Avatar
Member
311 posts
Joined: July 2005
Offline
I get that.

I'm just wondering what you are trying to do. If you can explain that we can help you.
User Avatar
Member
7708 posts
Joined: July 2005
Offline
dim1984kimo
How to make variables calculate every single frame?

Your scripting is in the imperative form [en.wikipedia.org] while Houdini's scripting works in the functional form [en.wikipedia.org].

To make a parameter change with time, a common way is to use the variable, $F, which is the current frame number.

If I guessed at your action script code correctly, you have a simple recurrence formula which I hope I have solved correctly to this expression:
5 - 5*pow(0.9,$F-1)

I've attached a simple .hip file.

Attachments:
movingfx_167.hip (39.1 KB)

User Avatar
Member
84 posts
Joined: Aug. 2008
Offline
Hi,

Thank you all for this question.

I explain it now. My target is make an emitter which emits many woods and clays, they will automatically go to their position to build a house.

But it's not that kind of simple movement, I want it to be an acceleration or negative acceleration. If this target goaled, it should be step to next level, such as Simple Harmonic Motion with negative acceleration. That's my final goal.

If I wanna change to Simple Harmonic Motion with negative acceleration, then the AS needs to fix like this:
speed = (Xpos-this._x)*0.3+speed*0.9;
https://vimeo.com/jacyslin [vimeo.com]
User Avatar
Member
6 posts
Joined: May 2009
Offline
Simple harmonic motion
is periodic - as it repeats itself at standard intervals in a specific manner - and sinusoidal, with constant amplitude;

try this expression
sin($F*10)*2
where frequency=10 and amplitude=2, change the values according to ur need…
  • Quick Links