Rolling sphere on plain

Posted By: RyuMaster

Rolling sphere on plain - 11/07/08 19:53

Hi! I have sphere-like mdl file, rolling on mdl box. I used sample from G7 flder and adapted it:

Quote:
phent_settype(player,PH_RIGID,PH_SPHERE);
phent_setmass(player,1,PH_SPHERE);
phent_setfriction(player,0);
phent_setelasticity(player,75,100);
phent_setdamping(player,30,5);
// phent_addvelcentral(player,vector(10,10,0));
ph_setgravity(vector(0,0,-500));


Now, sphere rolls fine in direction given with phent_addvelcentral. If I set phent_addvelcentral to 0, it stops. Now, what I
do is make box plane model tilt by 15 degree. My idea is: if plane is tilt, ball will start rolling down. But it is not. Ball, actually,
rotates along with plane. Like, if I set

plane.tilt += 1; //every frame

plane rotates, and so does my spehere model. How can I adjust interaction the way I need?
Regards,
Konstantin.
Posted By: TSG_Torsten

Re: Rolling sphere on plain - 11/07/08 21:18

Already set "my.polygon=on;" for the plane below?
And does your level has a hollow block with flag "sky"? The physic engine may need this.

Regards
TSGames
Posted By: RyuMaster

Re: Rolling sphere on plain - 11/07/08 22:32

Hi! Yes, polygon is enabled for floor plane through the WED. I have sky plane created with ent_createlayer. But now I have tried to add hollow cube through WED and set is property to SKY - still the same result. I'll try to tweak parameters, there is gotta be a mistake in some action I did...
Posted By: RyuMaster

Re: Rolling sphere on plain - 11/07/08 22:57

Now I did few testing. I placed entity very high on start, and gave plane zero tilt value.
Entity falls, and bounces fine.
Now, if I tilt plane a bit, like for 15 degree, entity stays in place, but falls deeper into plane box.
The same result, if I tilt box from start. Entity falls deep into plane mesh and bounces, ignoring its top surface... HMMM.
Posted By: zwecklos

Re: Rolling sphere on plain - 11/10/08 16:30

Hi Ryu,
Have you tried to scale up your plain and your sphere model?
What happens when you decrease gravitaion (from -500 to -386)?

cheers
Posted By: RyuMaster

Re: Rolling sphere on plain - 11/10/08 16:44

Hi! Now, I got it working only by setting c_updatehull(ground, 0) every frame.

c_setminmax is not working.

So, is it normal, that I have to use hullupdate when I tilt objects?

All the time before, sphere ball was colliding with plane like plane had tilt 0, no matter what tilt it had in fact.

Also, if I use frame vertex animation for tilting plane, then even c_updatehull stops working.

Anyone had similiar experience or I'm the only unhappy person there?

I tweaked many parameters, gravitation as well. Currently I have got into one other problem. Sphere falls on my plane, bounces 1 time up, and second time it passes the plane with no collision. Like, it bounces with the plane if I place it on z = 200 starting distances, on distances from 100 to 200 it always passes through ground plane. I have normal scaled models, I tryed different geometry (like making box from plane). Do I have to set up something to make collision more percise?
Posted By: RyuMaster

Re: Rolling sphere on plain - 11/10/08 16:49

Was there any newton wrapper for A7? I can only see beta-one on the forums. Or the newton wrapper was only for A6? Because one more day and I gonna kill myself 0_0
Posted By: BES

Re: Rolling sphere on plain - 11/11/08 22:39

Hey RyuMaster,

I'm making a golf simulation, so I've had to deal with a number of the things you are.

Some things to try:
1) make sure to place some objects at the extremes of your world. Even with a skybox, the physics simulation is limited to the minimum boundaries necessary to encompass the root positions of all the items in your scene. Note that an object's "position" is frequently in the center of your object, so a single large block will not expand your boundaries at all.

2) Regarding falling through the ground, you will need to add safeguards to protect against this. Using c_trace to shoot a ray from your previous position to your current position should help to determine if you passed through something you shouldn't have.

3) The documentation suggests not to leave gravity pressing on your object all the time when it is on the ground. I dealt with this by reducing gravity drastically when my ball stops bouncing and starts rolling. You can manually add velocity that is gravity's contribution along the slope that your ball is on. Since you seem to have gotten addcentral working already, this shouldn't be too difficult for you.

There are many many things that can get in the way of physics, so make sure to start out with a super simple level, i.e. just a plane, ball, boundary expanders, and a hollow cube for a sky, then work from there.

Hope this helps!
Posted By: RyuMaster

Re: Rolling sphere on plain - 11/12/08 00:44

Thanks a lot! Yes, actually, step by step, little by little I found solutions and workarounds, and your tips helped in 1 certain situation. But, sight, well... It is programming, anyway smile
Posted By: zwecklos

Re: Rolling sphere on plain - 11/12/08 03:35

Hi Ryu,
I dont know if you still need help for your issue.
Anyway here you may find a possible solution for your problem.

swinging platform

cheers

Zwecklos
Posted By: RyuMaster

Re: Rolling sphere on plain - 11/12/08 16:15

cool, thanks!!! I'll see how You made it work, maybe it is much better then I did.
Posted By: RyuMaster

Re: Rolling sphere on plain - 11/12/08 16:18

BTW, in order to make my platform work, I had to create it by the script and set ph_check_distance = 1; Creating it in WED resulted in bad calculations no matter what. Hope it helps someone.
© 2024 lite-C Forums