Model to react to moving terrain waves?

Posted By: XNASorcerer

Model to react to moving terrain waves? - 01/26/05 01:40

How can I make my model to react to moving terrain waves?
Posted By: fastlane69

Re: Model to react to moving terrain waves? - 01/26/05 04:29

Good Question!

I have no idea!!

Possibility a) is that it does so automatically; that is the entity reacts to the geometry real time.

Possibility b) is that it won't do it at all; that is the entity only reacts to the original compiled geometry and not the scripted real time one. If this is true, it may be impossible as trace() would also react to compiled and not scripted terrain.



Have you run trials? What have you come up with?
Posted By: Marco_Grubert

Re: Model to react to moving terrain waves? - 01/26/05 06:17

Try calling c_updatehull to update the collision shape of your terrain after each animation frame.
Posted By: XNASorcerer

Re: Model to react to moving terrain waves? - 01/26/05 06:41

Can you be a little more specific? Can you give a example? I am trying to make a jet ski to move in the waves.
Thanks.
Posted By: fastlane69

Re: Model to react to moving terrain waves? - 01/26/05 08:10

Quote:

Try calling c_updatehull to update the collision shape of your terrain after each animation frame.




Awesome! It's good to know that terrain collision dynamics is real time. Thanks Marco!!!

@sorceror

A terrain, like an entity, can have a action attached to it. Call the above as part of it's action whenever you deform it and your entities should respond to the new terrain automatically!!! Very Nice!!!
Posted By: XNASorcerer

Re: Model to react to moving terrain waves? - 01/26/05 09:26

It says Error(269)- Syntax Error
Where should I put this "c_updatehull" and which are their parameters?
I am using this code from Aum:
Code:
 


define amplitude skill1;
define water_speed skill2;
define number_of_vertices 2025;//16896; // vertices x vertices. The .HMP Provided is 16896

////////////////////////////////////////////////////////////////////////////////////////

var vertex_array[number_of_vertices];
var counter;
var index;

function nice_waves
{
if (my.amplitude == 0)
{
my.amplitude = Onda;//3;//1.5;//.7; // This is the height
}
if (my.water_speed == 0)
{
my.water_speed = 7; // This is the speed of the waves
}
counter = 0;
while (counter < number_of_vertices)
{
vertex_array[counter] = random(360); // set random values in vertex_array
counter += 1;
}
while (1)
{
index = 0;
while (index < number_of_vertices)
{
vec_for_mesh(temp, my, index); // store the vertex coordinates in temp
temp.z = sin(counter + vertex_array[index]) * my.amplitude; // change the z component
vec_to_mesh(temp, my, index); // deform the terrain entity
index += 1;

}
counter += my.water_speed * time;
wait(1);
}
}


Posted By: XNASorcerer

Re: Model to react to moving terrain waves? - 01/27/05 09:27

fastlane69,

Did you manage to use c_updatehull?
Posted By: fastlane69

Re: Model to react to moving terrain waves? - 01/27/05 11:10

Nope. Haven't played around with it.
Posted By: Marco_Grubert

Re: Model to react to moving terrain waves? - 02/01/05 10:57

Sorry that was a misunderstanding. c_updatehull only retrieves animations stored in the MDL file.
Directly changing vertices is not supported, the collision hull update would take too long.
Posted By: fastlane69

Re: Model to react to moving terrain waves? - 02/01/05 11:02

Pity.
© 2023 lite-C Forums