About Store Forum Documentation Contact
Donations:
158$/mo



Post Reply 
Some question
Author Message
Jetro Offline
Member

Post: #1
Some question
1.Can I use PhysHit in GuiViewport?
2. Can i pick object by poly?
3. How to make grid?
02-21-2010 07:27 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Some question
1. yes
activate the viewport before using collision detection
3. draw lines
02-22-2010 04:48 PM
Find all posts by this user Quote this message in a reply
Jetro Offline
Member

Post: #3
RE: Some question
Not work Physhit at GuiViewport. Here's the code:

Code:
Camera *cam=NULL; // start with none

      if(Gui.viewport==&viewport[0])
      {
          cam=&camera[0];
          Gui.viewport->activate();

         if(Ms.b(1)) // only when mouse button pressed
         {
            cam->yaw  -=Ms.d.x;
            cam->pitch+=Ms.d.y;
         }

          if(Ms.wheel()<0)cam->dist*=1.2;
         if(Ms.wheel()>0)cam->dist/=1.2;

         cam->setSpherical();

         if(Ms.b(0))
         {
             Vec screen_pos,
                 screen_dir;
              ScreenToPosDir(Ms.pos, screen_pos, screen_dir);
              Vec start=screen_pos,
                  end  =screen_pos + screen_dir*75;

              PhysHit phys_hit;
              if(Physics.ray(start,end-start,&phys_hit))
              {
                  StateExit.set();
              }
              else
              {
              }
         }
02-23-2010 08:59 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Some question
Gui.viewport->activate();
I meant the Viewport (not GuiViewport object) :

gui_viewport.viewport.set..
cam->setSpherical().set();
02-23-2010 04:36 PM
Find all posts by this user Quote this message in a reply
Jetro Offline
Member

Post: #5
RE: Some question
Thank you! Now everything works!
And what about "2. Can i pick object by poly?"
(This post was last modified: 02-23-2010 05:29 PM by Jetro.)
02-23-2010 05:27 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Some question
please be more specific - what you want to do
02-24-2010 12:33 AM
Find all posts by this user Quote this message in a reply
Jetro Offline
Member

Post: #7
RE: Some question
I want to make a map editor for Action game. And I want to could be pick cube by poly and a separate poly could applied a texture.
02-24-2010 04:06 PM
Find all posts by this user Quote this message in a reply
Jetro Offline
Member

Post: #8
RE: Some question
How to use func mesh.Draw2d()?
02-25-2010 04:14 PM
Find all posts by this user Quote this message in a reply
Post Reply