Author Topic: Iniciando...  (Read 9066 times)

Offline aguirmrc

  • byte
  • *
  • Posts: 1
    • View Profile
Iniciando...
« on: October 31, 2006, 10:37:39 pm »
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)

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Iniciando...
« Reply #1 on: November 01, 2006, 04:07:31 am »
Solo ingles, no portugues!
Nada por ahora

Offline Uija

  • int
  • **
  • Posts: 52
    • View Profile
Iniciando...
« Reply #2 on: November 01, 2006, 09:09:17 am »
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.

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Iniciando...
« Reply #3 on: November 01, 2006, 03:09:03 pm »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Iniciando...
« Reply #4 on: November 01, 2006, 03:32:41 pm »
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.

Offline Leandro

  • byte
  • *
  • Posts: 3
    • View Profile
Iniciando...
« Reply #5 on: November 05, 2006, 01:50:33 am »
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.

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Iniciando...
« Reply #6 on: November 05, 2006, 03:59:54 pm »
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

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Iniciando...
« Reply #7 on: November 07, 2006, 03:37:33 pm »
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.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Iniciando...
« Reply #8 on: November 07, 2006, 03:48:09 pm »
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.

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
Iniciando...
« Reply #9 on: November 24, 2006, 01:13:48 am »
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

Offline manumoi

  • long
  • ***
  • Posts: 121
    • View Profile
    • http://www.iro.umontreal.ca/~blanchae
Iniciando...
« Reply #10 on: November 24, 2006, 06:40:50 am »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Iniciando...
« Reply #11 on: November 24, 2006, 09:27:56 am »
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:

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
Iniciando...
« Reply #12 on: November 24, 2006, 03:30:49 pm »
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