SFML community forums

General => General discussions => Topic started by: reethok on May 18, 2013, 07:27:47 pm

Title: Whats the simplest phisics library that works good with SFML?
Post by: reethok on May 18, 2013, 07:27:47 pm
I just need collision detection :)

Greetings.
Title: Re: Whats the simplest phisics library that works good with SFML?
Post by: Nexus on May 18, 2013, 07:34:29 pm
I just need collision detection :)
What kind of collision detection? If rectangles or circles are enough, just implement it yourself.
Title: Re: Whats the simplest phisics library that works good with SFML?
Post by: reethok on May 18, 2013, 08:18:50 pm
Different form sprites with transparency. Also, as there will be many of them, i need some efficiency
Title: Re: Whats the simplest phisics library that works good with SFML?
Post by: Nexus on May 18, 2013, 08:52:04 pm
What forms will you have? This determines what collision algorithms to use...

(And how does transparency influence the collision? You probably want to have a separate logical representation of your shapes anyway)
Title: Re: Whats the simplest phisics library that works good with SFML?
Post by: reethok on May 18, 2013, 10:23:38 pm
Something like this:

(http://memberfiles.freewebs.com/37/52/64535237/photos/Sharing-Sprites/redLaserRay.png)

But will be many different animations (laser and different kind of bullets).

It's for a simple Tower Defense game I want to do. I know how to do everything allready except the collition part.

What i want is t skip the total transparency (it doesnt count of rthe collition), and to set a lvloftransparency that counts. (In that laser sprite, just the brightest will count for the cllition)

Sorry for my crappy english :A
Title: Re: Whats the simplest phisics library that works good with SFML?
Post by: eXpl0it3r on May 20, 2013, 04:11:31 pm
Pixel perfect collision is an expensive test and in most cases not unnecessary. You might be way better of with a rotated bounding box test, just google a bit for it.

Tower defense is a widely spread topic, maybe you could give some more insight on how exactly it will be.
Title: Re: Whats the simplest phisics library that works good with SFML?
Post by: kralo9 on May 21, 2013, 04:32:25 pm
I wouldn't use a real collision detection for tower defense games. Instead, you could let the bullet fly towards the targeted enemy and then just check the distance between enemy and bullet. Then for approving collision, you can say, that every distance lower than 5.f is a hit or at the latest when the distance starts increasing (the bullet passed the enemy).

That would be a really fast "collision" detection (maybe checking distances, circle collision detection, is the fastest)

Give it a try! :D