• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Martin Perry

Stop objects and clear all forces

9 posts in this topic

I have objects that are sliding on a tilt plane (under teh angle of 30°). When they reach the end of the plane, I would like to clear all forces and let objects fall directly down with only gravity affecting them.

 

Currently, all my objects continue to move in a direction of plane´s tilt and are "slowly" pushed down by gravity (the speed of push down depends on objects speed and mass).

 

How to achieve such a behaviour ? And is it even possible ?

 

Thanks

0

Share this post


Link to post
Share on other sites

my objects continue to move in a direction of plane´s tilt and are "slowly" pushed down by gravity (the speed of push down depends on objects speed and mass).

 

That's how it should work, except the "push down" doesn't depend on speed. Force = mass * gravitational_constant. They continue in the direction of the plane's tilt because they have horizontal and vertical speed built up from sliding down the ramp. If there's no horizontal force acting on them after they fall off the end of the ramp, they will continue in the horizontal direction at the same speed. The vertical speed will increase as gravity accelerates the object.

 

If you just want them to "fall off" the edge unrealistically, detect when the object's position is just beyond the edge of the plane and set the object's horizontal and vertical speeds to 0. If you've got things setup correctly, then, at that point, gravity will be the only force.

Edited by Buckeye
0

Share this post


Link to post
Share on other sites

There is a problem with this approach, how to find out, that objects is no longer above the plane and should fall. If I hard-code some conditions, it wont work universally. Also, setting velocity to 0 must be done only once - how to find out when - and not continuously (it deactivate gravity).

0

Share this post


Link to post
Share on other sites

You can put an invisible vertical plane just beyond the end of the ramp. That will zero the horizontal speed, but not the vertical. For that you can put a short horizontal plane at the end of the ramp.

 

I.e., final configuration: ramp, short horizontal plane, gap, vertical plane.

Edited by Buckeye
1

Share this post


Link to post
Share on other sites

You'll have to pardon my ignorance with bullet, but in Box2d you could do a check to see if the objects are in contact with the ramp, and if they aren't remove all but the downward force.  You might have to do a little fudging to only have this occur if the objects are under a certain value, so that if they bounce up off the ramp before hand they don't suddenly stop moving in any other direction.

 

Doing the invisible plane thing might work, but you'd definitely see a bounce if anything was sliding fast.  (for slow objects, it probably is fine.)

2

Share this post


Link to post
Share on other sites

Well.. I have tried to find out something that indicats, that objects are in contact with something, but found nothing.

0

Share this post


Link to post
Share on other sites

Well.. sort of :-) I will have to add some other info to my SceneObject and with that it should work. Thanks for now

 

EDIT: Ok.. I have condition and succesfully tested if objects left the plane. But calling clearForces has no effect. How to do it other way?

Edited by Martin Perry
0

Share this post


Link to post
Share on other sites

you should consider friction. Only force that aplies over your objects all the time (in your scenario) is gravitation atraction force, AND, friction eliminating force.

 

If your object seem to slide at extreme speed resulting in unrealisticc platform donated outer propagation, you are making your object slide a 30 degrees perfect ice smotth platform. (I have crashed my head at such a thing as little brat)

 

Results are rather strange efect.

 

If you were free falling towards a point, and colapssed a ground before it with a perfect friction,  you would propagete to the pont with same speed still!- thus creating extreme advenced aside movement! (creating an impossible result even physicaly, but phenomenaly existing)

 

see friction in bullet, straightly compared to weight, tendence and potential

0

Share this post


Link to post
Share on other sites


But calling clearForces has no effect. How to do it other way?

You need to do two things:

1. Detect that you dont hit the ground any longer:

Either check contacts or use raytests. Bullet supports contact manifolds and ray casting. To avoid some miss-behavior for bouncing objects, I would check the last 2 frames, that is, you have ground contact only if you detect a contact this and in the last frame.

 

2. Nullifying the forces is only one part, you still need to clear the current velocity, thought you can keep the up-down (y-axis) velocity.

1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0