www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: MegasXLS on February 16, 2011, 10:59:37 pm

Title: Divide Plane
Post by: MegasXLS on February 16, 2011, 10:59:37 pm
Hello everybody,
I would like to know a way to divide my plan.
Is that when the user wants to move your character in the plane, he will click the character after that and asked where to direct the character. Similar to Dragon Mage project. I wanted to divide the plane so that when the mouse cursor passed over it a simple square changed color for the user to know where the character will.

Thanks in advance
Title: Re: Divide Plane
Post by: MegasXLS on February 16, 2011, 11:27:26 pm
1 - What is the best way to click on a 3D object and clicking the I plan to move the object to that place? I want my character to move anywhere in the plan by clicking somewhere in the plane.
Title: Re: Divide Plane
Post by: EgonOlsen on February 17, 2011, 08:28:44 am
It might be a better idea to simply use a kind of marker instead of modifying the plane itself. Concerning your second question: What you need here is picking. The wiki has a page about it or you can have a look at (for example) this thread: http://www.jpct.net/forum2/index.php/topic,1932.0.html (http://www.jpct.net/forum2/index.php/topic,1932.0.html)
Title: Re: Divide Plane
Post by: MegasXLS on February 17, 2011, 02:09:08 pm
How i use this Marker?
thanks for the answer.
Title: Re: Divide Plane
Post by: EgonOlsen on February 17, 2011, 02:26:52 pm
Create another, smaller plane and place it where you want to...just get creative.
Title: Re: Divide Plane
Post by: MegasXLS on February 17, 2011, 03:22:41 pm
True. It Worked.

Olsen, I'm trying to make my character in the format MD2 get animated. I'm using the AdvancedExample snork. When my desktop application was able to animate it using the method of AdvancedExample animate well, but in the applet it does not get animated. He is already being shown usually along with other objects, but not animated.
You know why?

thanks
Title: Re: Divide Plane
Post by: EgonOlsen on February 17, 2011, 03:23:59 pm
Most likely because you did something wrong. Impossible to say without seeing any code.
Title: Re: Divide Plane
Post by: MegasXLS on February 17, 2011, 03:25:46 pm
Tradução do português para inglês
Oh, I call the method animate(ticks) in the run method of my applet.

public void run(){
        long ticks = 0;
        while (loop){
            this.repaint();
            
            try{
                Thread.sleep(10);
            }catch(Exception e){
                            }
            ticks = ticker.getTicks();
            if (ticks > 0) {
               animate(ticks);  
               move(ticks);
              
            }
        }
    }
Title: Re: Divide Plane
Post by: MegasXLS on February 17, 2011, 03:26:57 pm
public void animate(long ticks) {

      if (ticks > 0) {

         float ft = (float) ticks;
         ind += 0.02f * ft;
         if (ind > 1) {
            ind -= 1;
         }

         snork.animate(ind, 2);
}
Title: Re: Divide Plane
Post by: MegasXLS on February 17, 2011, 03:29:21 pm
I have tested animate(ticks) in my method public void paint( Graphics g ) but not worked too. =(
Title: Re: Divide Plane
Post by: MegasXLS on February 17, 2011, 04:17:44 pm
Olsen Thanks for the help.

I managed to animate the snork.
Trade the instructions:

snork.compileAndStrip();

for

snork.compile (true, false, true, false, 1000);

Title: Re: Divide Plane
Post by: EgonOlsen on February 17, 2011, 05:02:40 pm
Yes, compile() or compileAndStrip() don't work for animated objects. But that can't be taken from the Advanced Example!?
Title: Re: Divide Plane
Post by: MegasXLS on February 17, 2011, 06:57:36 pm
Yes, but I changed that instruction in some tests and ended up not changing back. ^^" y