Create 3D surface with a dimension and an angle for [physics] skill

32 views
Skip to first unread message

Benjamin Mewes

unread,
Mar 6, 2019, 5:00:37 AM3/6/19
to GAMA
Dear all,

I would like to create a surface with an angle to use as a ground plate in the [physics] skill. Do you know a trick to do that?

Moreover, is there a chance to use BulletPhysics (which I suppose as the foundation of the physics skill) to use the friction to determine the velocity of an object?

Benjamin Mewes

unread,
Mar 6, 2019, 9:45:53 AM3/6/19
to gama-p...@googlegroups.com
Okay, I managed to rotate a plane. Nevertheless, I face several problems.

1.) The location of the ground seems to vary with each new start of the model?

2.) Is there a chance to modify the collisionbound to fit the inclined plane?

Here is the model code:

/***
* Name: NewModel1
* Author: Mewes
* Description:
* Tags: Tag1, Tag2, TagN
***/

model NewModel1

/* Insert your model definition here */

global {

//Variables
float globalWaterTransport <- 10E-3; // mm³
int dimension <- 50;
int scale <- 50;


rgb colorwood <- rgb([178, 112, 62]);

//Physics engine
physic_world world2;

init {

create ground {
collisionBound <- ["shape"::"floor", "x"::dimension, "y"::dimension, "z"::-10];
location <- {50,0};
mass <- 0.0;
}



create WaterAgent number: 10 {
location <- {rnd(dimension),rnd(dimension),rnd(10)};
collisionBound <- ["shape"::"sphere", "radius"::waterTransportPerAgent];
mass <- waterTransportPerAgent/scale;
color <- #yellow;
}

create physic_world {
world2 <- self;

ask world2 {
agents <- (WaterAgent as list)+(ground as list);
}


world2.gravity <- true;
}


}



reflex computeForces {
ask world2 {
do compute_forces step: 1;
}



}
}



species ground skills: [physics] {

geometry myGeometry <- rectangle(dimension,dimension) rotated_by (-10,{1,0,0});

aspect default {
draw myGeometry color: rgb(255, 255, 255);
}

}



species WaterAgent skills: [physics] {
float waterTransportPerAgent <- globalWaterTransport*scale;
rgb color;
float mass <- 1.0;




aspect sphere{
draw sphere(waterTransportPerAgent) color: color ;
}

}

species physic_world parent: physical_world ;


experiment Init type: gui {
output {
display cells type:opengl draw_env: true {
species ground;
species WaterAgent aspect:sphere;
}
}
}

Patrick Taillandier

unread,
Mar 7, 2019, 4:30:40 AM3/7/19
to gama-p...@googlegroups.com
Hi,

As I am not the one that has developed the physic plugin, it is a bit difficult for me to answer. If you could share a very simple model that shows the problems that you need, I can try to do something.

Cheers,
Patrick

Le mer. 6 mars 2019 à 15:45, Benjamin Mewes <bennam...@gmail.com> a écrit :
Okay, I managed to rotate a plane. Nevertheless, I face several problems.

1.) The location of the ground seems to vary with each new start of the model?

2.) Is there a chance to modify the collisionbound to fit the inclined plane?

--
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platfor...@googlegroups.com.
To post to this group, send email to gama-p...@googlegroups.com.
Visit this group at https://groups.google.com/group/gama-platform.
For more options, visit https://groups.google.com/d/optout.

Benjamin Mewes

unread,
Mar 7, 2019, 5:02:42 AM3/7/19
to GAMA
Hi Patrick,

I attached a simple model. I appreciate your help!

simplePlane.gaml

Patrick Taillandier

unread,
Mar 7, 2019, 9:04:42 AM3/7/19
to gama-p...@googlegroups.com
Hi,

I modified a bit the code of the physic plugin and it should work better now. 
New version of your simplePlane model:


model NewModel1

global {
int dimension <- 75;
physic_world physic_manager;
init {
create ground {
shape <- (square(dimension) at_location myself.location) rotated_by (-10,{1,0,0});
mass <- 0.0;
}
 
create WaterAgent number: 100 {
location <- location + {0,0, rnd(10, 50.0)};
collisionBound <- ["shape"::"sphere", "radius"::1.0];
mass <- 0.02;
}
create physic_world {
physic_manager <- self;
ask physic_manager {agents <- (WaterAgent as list)+(ground as list);}
physic_manager.gravity <- true;
}
}

reflex computeForces {
ask physic_manager {do compute_forces step: 1.0;}
}
}

species ground skills: [physics] {
aspect default {
draw shape color: #gray;
}
}

species WaterAgent skills: [physics] {
rgb color <- rnd_color(255);
float mass <- 1.0;
reflex disapear when: location.z < - 100 {
do die;
}
aspect sphere{
draw sphere(1.0) color: color ;
}
}

species physic_world parent: physical_world ;

experiment Init type: gui {
float minimum_cycle_duration <- 0.01;
output {
display cells type:opengl draw_env: true  {
species ground;
species WaterAgent aspect:sphere;
}
}


Le jeu. 7 mars 2019 à 11:02, Benjamin Mewes <bennam...@gmail.com> a écrit :
Hi Patrick,

I attached a simple model. I appreciate your help!

Benjamin Mewes

unread,
Mar 8, 2019, 7:44:35 AM3/8/19
to GAMA
Dear Patrick, thanks for the modification! The plane works now wonderfully!

I just realised that by the changes an older model does not run anymore. When an Agent touches the Tube, it infiltrates and becomes a different class. But I can not calculate the physics within the Tube anymore (Since the last changes). I tried to simplify the model (and removed the SoilWaterAgents from the physics), is there a way to debug it, why it is not able to calculate the physics anymore?

Tube.gaml
Reply all
Reply to author
Forward
0 new messages