Jump to content

Recommended Posts

Posted

When I apply friction to a an object (ball in the minigolf game), it doesn't seem to affect it at all. Are there minimum and maximum values that I should use for friction?

 

I have used values as low as 0.001 to 10000 for both kynetic as well as static friction.

Posted

Hi Aggror,

 

for me friction makes a huge difference.

 

I set the Friction in my Lua script for the Player entity:

function Script:Start()
 self.entity:SetFriction(1,1)
end

 

when i set it to SetFriction(0,0) it behaves as it would roll on ice.

Posted

Values above 0 seems to register the same. 0 is like ice but setting it to 1 makes no difference than setting it to 100.

Elite Cobra Squad

Posted

Okay so a value between 0 and 1 is required. The problem I still have is that the friction doesn't seem to be doing anything to my object.

I have added friction to both the ground and the ball but the ball just keeps on rolling like it has no resistance at all. I will upload a video.

 

Also, when a ball hits a side, it completely absorbs rebound power, while the acceleration in the hitting direction is slowly decreasing. The walls have friction set to 0. This is really weird behavior that makes it difficult to continue working on it.

Posted

why are you setting friction for your walls or ground?

 

i think it is better to use csg for the walls and only change the settings of the ball.

 

 

Do you scale your ball model in the engine?

 

I had an issue in a previous version of Leadwerks that the physic was going crazy because i scaled the model. I think it is fixed now but i am using a properly scaled model now and haven't tested it again.

Posted

Set Kinetic friction on the ground to 1.0 and don't give the ball a friction command.

 

Not sure about absorbing the rebound power.

Elite Cobra Squad

Posted

Besides the ball, everything is CSG. I am applying friction to various objects because I have no idea what else to do. I tried all sorts of combinatoins

  • Only the ball
  • Only the floor
  • Only the walls
  • Ball and floor.

It just doesn't affect it. It is weird because in a tutorial that I created, it all worked for me.

 

@ beo: Yes I have done a resize in the editor. I will try to rescale outside leadwerks to see if that works.

Posted

Hello Aggror.

 

Can you also check the size compared to the cylinder of the character-controller that is shown when you enable physic-debug in editor?

My ball very much exactly the size of the width from this cylinder.

Posted

I figured it might be to small and the physics don't like that. Are you using force or torque to move your ball?

The ball on the left is what I used previously. The on the right is for the testing I am doing right now.

 

post-45-0-36273400-1370427999.jpg

  • 2 weeks later...
Posted

In an effort to teach myself, I've done your tutorials and started doing something similar with a ball, floor and walls. I'd be interested in any suggestions or advice as you run into it. Here's what I'm doing now. b

ball = Model::Sphere();
ball->SetMaterial(boxMaterial);
ball->SetPosition( 0, 0, -1 );
//ball->SetVelocity(Vec3(1,1,1));
ball->AddForce(-30000,0,0);

Shape* ballShape = Shape::Sphere(0,0,0, 0,0,0, 1,1,1);
ball->SetShape(ballShape);
ball->SetMass(10);
ballShape->Release();

ball->SetPhysicsMode(Entity::RigidBodyPhysics);
ball->SetCollisionType(Collision::Prop);

 

 

Dean Witcraft

Lots of programming experience, 0 game development

Posted

Torque or a linear force don't make a difference in the balls behavior so that is not the problem (for me at least :) ).

 

Loading in a custom model of a sphere seemed to improve the motion of the ball which is deffinetly a big plus. the problem that remains is that the ball takes a really lone time before it stops moving. These are approaches that I tried:

 

Model and shape:

  • CSG brush sphere with editor shape fitting
  • Sphere created via API with code created shape.
  • Model imported of a sphere. Shape generated via editor as well as a programmeticly created shape.
  • Friction set either via lua script or via C++ property.
  • Changing the brush size from 1 to 10 units. Maybe size matters?
  • Setting kinetic, static or static/kinetic friction on:
    • just the ball
    • just the floor
    • ball and floor

I have tried all sorts of combinations on all the possibilities above, but I have yet to see any difference between them. Friction is somewhat none existing for my game. Others can clearly see friction in their games so I must be doing something wrong.

 

 

This problem and the problem with the physics bug I have when switching levels, has costed me more time then making levels and programming the gameplay so far. That includes making the game multiplayer! It is getting frustrating and I find it difficult to find motivation on spending more time on this project. I have put it aside for now till more updates of the engine arive.

Posted

This may be a really stupid suggestion, but please try to follow my train of thought.

 

If you take a sphere with 12 sides, and compare it to a sphere with 36 sides, the rotation angle is bigger with the 12sides.

So since each face is bigger, it requires more force to roll onto the next face. It will stop sooner.

It's movement would be more "stuttered" towards the end, and it's impact with any other objects (walls/borders) would absorb alot of force.

 

I'm not sure if how the engine perceives a model of an object different to an exact replica in csg format, but maybe increasing the "sides" will help with it. It's not like your using a huge number of poly's anyway so where is the harm is say trying with 100sides to see how it compares.

 

Test 1: 10sides

Test 2: 25sides

Test 3: 100 sides

 

Compare all three (both model & csg) try to find the consistancies.

Operation Mosquito

Recruiting 3d Modeller/Animator. (pm if interested)

 

It is the greatest of all mistakes to do nothing because you can do only a little. Do what you can. - Sydney Smith
Posted

Thanks for the suggestion Mike. But I have already tried that actually. I tested this for API spheres as well as imported models. I have used the following amount of polygons:

  • 8
  • 32
  • 128

The amount of force increase slightly with every higher amount of polygons but behavior does not change.

Posted

Friction is working correctly in the video you posted. If there was no friction, under a linear applied force, the ball would slide without rotating, under an applied torque, the ball would rotate without moving. Since your ball is both rotating and moving friction is working. What you are looking for is rolling resistance, and I'm not sure how that is applied in LE.

 

With regards to your wall collisions, the problem is that the restitution is relatively high. This setting allows for energy to be absorbed during collisions to dampen oscillating interactions. A squishy ball like a soccer ball should have a moderate restitution, a bouncy ball and a solid ball like a billiard ball should both have low restitution. Again, I'm not sure exactly how that's set in LE, but I'm sure there is a setting.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...