Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (577)
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 2730 times)
0 Members and 1 Guest are viewing this topic.
Offline Nitrooo

Junior Newbie





« Posted 2006-03-09 20: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 Duke




aka Abuse/AbU5e/TehJumpingJawa


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

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

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #2 - Posted 2006-03-10 11: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
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Anon666

Junior Duke




aka Abuse/AbU5e/TehJumpingJawa


« Reply #3 - Posted 2006-03-10 13: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 15: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 Duke




Go Go Gadget Arms


« Reply #5 - Posted 2006-03-16 00: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 17:48:26 »

LERP?
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


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

Google?

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

 

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

The first screenshot will be displayed as a thumbnail.

Longarmx (49 views)
2014-10-17 03:59:02

Norakomi (38 views)
2014-10-16 15:22:06

Norakomi (31 views)
2014-10-16 15:20:20

lcass (34 views)
2014-10-15 16:18:58

TehJavaDev (65 views)
2014-10-14 00:39:48

TehJavaDev (65 views)
2014-10-14 00:35:47

TehJavaDev (54 views)
2014-10-14 00:32:37

BurntPizza (72 views)
2014-10-11 23:24:42

BurntPizza (43 views)
2014-10-11 23:10:45

BurntPizza (84 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!