Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  pick() very slow on terrain mesh  (Read 2146 times)
0 Members and 1 Guest are viewing this topic.
Offline Nitrooo

Junior Newbie





« Posted 2006-03-09 21:35:31 »

hi, i'm developing my first 3d game using m3g.
it is a space shoot'em up.
i implemented the terrain with heightmaps using a single triangle strip and i have the spaceship (a cube, at the moment) flying around the surface of the planet.
the fps were about 30 on my nokia n70, not bad;
today i tried to add the collision between the ship and the terrain but i discovered that the pick() method is terribly slow on my mobile...
here is the instruction:

1  
2  
3  
4  
if (terrain.group.pick(-1, lander.position[0], lander.position[1], lander.position[2], temp[0], temp[1], temp[2], ray))
{
//no code here!
}


"terrain" is an instance of a class written by me that implements the heightmap, "group" is a Group that has just the terrain mesh as child, "lander" is the spaceship and "temp" is the direction vector.
The code works, but it's extremely slow, about 4fps on my phone, i tried to lower the complexity of the terrain and the situation improves, but not enough.
the terrain at the moment has 2738 triangles, 1444 vertices and 8214 indices. with this mesh i get 8fps....
commenting the pick() call, fps return to about 30 fps.

is this normal or am i wrong in something?

what can i do to implement the collision with the terrain?
i don't want to lower further the number of polygons of the terrain...

thank you
Offline Anon666

Junior Member




aka Abuse/AbU5e/TehJumpingJawa


« Reply #1 - Posted 2006-03-10 02:21:45 »

yup, picking is slow on every handset i've tried it on. Typcially ranging from bad, to catastrophic.
Online Riven
« League of Dukes »

JGO Overlord


Medals: 439
Projects: 4


Hand over your head.


« Reply #2 - Posted 2006-03-10 12:56:35 »

One way to get around it is not to pick every frame, if that is enough for you to work with.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Projects: Revenge of the Titans, Titan Attacks, Droid Assault, and Ultratron
Games published by our own members! Check 'em out!
Try the Free Demo of Revenge of the Titans
Offline Anon666

Junior Member




aka Abuse/AbU5e/TehJumpingJawa


« Reply #3 - Posted 2006-03-10 14:20:11 »

Or simply not use it at all.

Do you realy need collision detection accurate to the visual geometry? or will a more simplified approach suffice.
Offline Nitrooo

Junior Newbie





« Reply #4 - Posted 2006-03-10 16:10:31 »

i thought about a solution....
i could split the terrain in many smaller meshes and many groups, then use the position of the ship to determine on which group/mesh i have to test the collision with the pick() method.
this way the pick() method will be performed on a as little as i want number of polygons...
hope this works...
Offline darkprophet

Senior Member




Go Go Gadget Arms


« Reply #5 - Posted 2006-03-16 01:31:18 »

what are you picking for? Are you picking so that your spaceship stays above the terrain and goes up and down?
If so, you dont need picking. What you want to do is LERP between the 4 nearest grids on your heightmap.

DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Offline Nitrooo

Junior Newbie





« Reply #6 - Posted 2006-03-16 18:48:26 »

LERP?
Online Riven
« League of Dukes »

JGO Overlord


Medals: 439
Projects: 4


Hand over your head.


« Reply #7 - Posted 2006-03-16 18:51:42 »

Google?

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Projects: Revenge of the Titans, Titan Attacks, Droid Assault, and Ultratron
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Try the Free Demo of Revenge of the Titans

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (121 views)
2013-05-17 21:29:12

alaslipknot (129 views)
2013-05-16 21:24:48

gouessej (159 views)
2013-05-16 00:53:38

gouessej (151 views)
2013-05-16 00:17:58

theagentd (164 views)
2013-05-15 15:01:13

theagentd (149 views)
2013-05-15 15:00:54

StreetDoggy (193 views)
2013-05-14 15:56:26

kutucuk (217 views)
2013-05-12 17:10:36

kutucuk (216 views)
2013-05-12 15:36:09

UnluckyDevil (219 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.11 seconds with 21 queries.