Bobbing in water motion

Posted By: Stansmedia

Bobbing in water motion - 06/19/14 17:49

Does anybody know of a good way to create a bobbing in water motion? Like just a subtle Z/tilt/roll motion. I would imagine its some kind of sin formula but I've never wrapped my head around that stuff.
Posted By: CyberGhost

Re: Bobbing in water motion - 06/19/14 18:22

There is something like that in the AUM, but I think it's a bit sharp and slow ...
Posted By: Stansmedia

Re: Bobbing in water motion - 06/19/14 18:24

Well. If I knew how to use the search feature, this thread would not exist. Heres the code I whipped up:

You'll never guess who's thread response helped me solve this. I'll give you a hint: The name starts with S and rhymes with uperku

Code:
action bobinwater()
{
	set(my,PASSABLE);
	VECTOR origin;
	vec_set(origin,my.x);
	ANGLE organg;
	organg.tilt = my.tilt;
	organg.roll = my.roll;
	var bob;
	while(1)
	{
		bob += time_step*5;
		bob %= 360;
		my.z = origin.z-sinv(bob);
		my.roll = organg.roll+12*sinv(bob+90);
		my.tilt = organg.tilt+5*sinv(bob);
		my.pan += time_step*0.1;
		wait(1);
	}	
	
}

Posted By: CyberGhost

Re: Bobbing in water motion - 06/19/14 19:47

LOL laugh
Posted By: Wjbender

Re: Bobbing in water motion - 07/03/14 21:10

you could also create a sinking / float action by
turning off gravity or making the object massless
when the object is beneath the
water hight (after sinking a bit), when its beneath some limit or for some time you then apply
a small upward force to the object , when the
object reaches above a certain hight you again
switch off gravity ...

this will also alow your object to rotate around
more freely like an outer space environment. .
© 2024 lite-C Forums