Iniciando...

Started by aguirmrc, October 31, 2006, 10:37:39 PM

Previous topic - Next topic

aguirmrc

Oi, estou começando agora a trabalhar com ambiente 3D e escolhi o motor grafico JPCT para iniciar. A minha duvida é o seguinte:
Como faço para desenhar 2 cubos na tela e ao movimentar um cubo pelo teclado, detectar a colisão quando um cubo sobrepor outro?
(idioma: pt - Brazil)

Melssj5

Solo ingles, no portugues!
Nada por ahora

Uija

I still cannot understand, why there are so many people out there, that enter a forum where every post is in english and post their stuff in another language. Do those people think, everyone is understanding them?
Sorry, this is 100% offtopic, but I felt like posting it.

Melssj5

Well, Maybe he never read a rule saying (All post must be in English!!!!!) Maybe he just dont know English! Anyway maybe there should be an internacional section where everyone could speak its language, maybe not. But its an idea.
Nada por ahora

EgonOlsen

I don't have a problem with people posting in other languages (there are some german postings too, but all moved to the "german corner") as long as people don't expect me to answer these questions.

Leandro

Ok, the question is a very basic one, just like my english :oops:

From portugues to a I-keep-learning-english:

Quote
Hi, I am at the beginning of my work on 3D environments and I choose the JPCT engine to start. My question is:
How do I draw 2 cubes on the screen and detect their collision when I move one of that through the keyboard?

aguirmrc, I suggest you to download this demo: http://www.jpct.net/download/carbench.zip. Then "eat it"! See how the things are implemented, make changes in the source code and see what happens, etc.

Melssj5

I also undestood the question as many other but the problem is how to explain it because I can read some portuguese due to my spanish but I cant write it.
Nada por ahora

AGP

To answer Uija, perhaps some people assume that the American people are more sofisticated than in fact they are. I still remember some eight years ago when they did that survey asking American students where the USA was in a world map and an astounding percentage (don't remember how much) didn't know the answer. I wonder if Bush Jr. did before taking the job.

To answer aguirmrc. I don't know how broad your question is (that is to say, I don't know how much you already know to do), but I'll address the collision-detection. If you're not new to Java programming, adding a listener should be nothing new to you. So just as you would add a KeyListener to a Frame, you add a CollisionListener to an object (in this case, both cubes). Next, call Object3D.setCollisionMode(Object3D.COLLISION_CHECK_SELF) for one and Object3D.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS) for the other. Write your collision-response code in the public void collision(CollisionEvent) method you'll have to override when implementing the CollisionListener interface, and do whatever you want with requiresPolygonIDs() (overwride it with nothing if you want to--but don't forget the return statement!). Now, every time you move one of the cubes (either in a loop for the automatic or manually through keyPressed(KeyEvent)), you have to call Object3D.checkForCollisionX(). Voila.

If that's not enough, write back and I'll explain step by step.

AGP

In Portuguese (just the part to aguirmrc):

Eu não sei o quanto você já sabe, mas eu vou falar sobre a detecção de colisão. Se você tem experiência com Java, adicionar um listener deve ser algo que você já fez muitas vezes. Então, como você adicionaria um KeyListener a um Frame, você adiciona um CollisionListener a um objeto (neste caso, ambos os cubos). Depois, chame Object3D.setCollisionMode(Object3D.COLLISION_CHECK_SELF) para um e  Object3D.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS) para o outro. Escreva o código que lidará com colisão no método public void collision(CollisionEvent) que você terá que override quando implementando a interface CollisionListener, e faça o que quizer com requiresPolygonIDs() (overwride com nada, se quizer--mas não esqueça do return statement!). Agora, toda vez que você mover os cubos (ou em um loop para o cubo automático ou manualmente pelo keyPressed(KeyEvent)), você terá que chamar Object3D.checkForCollisionX(). Voila.

Se isto não for o suficient, volte a escrever que eu explico passo a passo.

cyberkilla

Argh, I wish I was fluent in german, aber mein deutsch ist nicht so gut weil ich bin doof.

Es ist nacht, und ich schlaffe musse(must? no special symbol:P).

My grammar is all wrong for the most part.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

manumoi

On peut parler en Francais aussi???


Damn this thread looks like the babel tower now :D


PS: good to see that the activity is back on the forum... Welcome to new members.

EgonOlsen

Quote from: "cyberkilla"Argh, I wish I was fluent in german, aber mein deutsch ist nicht so gut weil ich bin doof.

Es ist nacht, und ich schlaffe musse(must? no special symbol:P).

My grammar is all wrong for the most part.
No, that's pretty good. The first sentence is quite correct. Just switch the "bin" and the "doof" and you are done. The way you wrote it is not correct but common speech. The second one should read "Es ist Nacht, und ich muss schlafen."... :wink:

cyberkilla

Wow, im a little shocked:)

I would very much like to learn german.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG