February 04, 2012, 03:50:20 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Please report any bugs or issues that you might be encountering with the Beta in the Support System so that we can better keep track of any oustanding issues that may come up.

GameCore Support System
 
   Home   Help Search Login Register  
Pages: 1 [2]
  Print  
Author Topic: Rotating an object when I press a key  (Read 1566 times)
ross.rockafellow
Global Moderator
Full Member
*****
Posts: 142



View Profile
« Reply #15 on: May 05, 2010, 11:33:43 AM »

I think I'm on the right track =).

Have you tried the physics using the joint and connector method? I'm going that route now and it seems like it will work out. I'll post more of my experimenting later in the day.
Logged
BigDaz
Sr. Member
****
Posts: 345


HardCore


View Profile
« Reply #16 on: May 05, 2010, 12:26:28 PM »

Thanks Smiley

I got things moving using ObjectBases and then realised ObjectBases can contain everything except collision objects.
Logged
ross.rockafellow
Global Moderator
Full Member
*****
Posts: 142



View Profile
« Reply #17 on: May 05, 2010, 04:09:20 PM »

Good news and bad news

Good news: I got an object rotating with collision

Bad news: I haven't got it working with a keypress event yet, hopefully I'll have a little more time tomorrow to play with it

I have an object set up and I just have it rotating from game start, here is the magic chunk:

void DynamicsAdvance( Object@ object, float seconds)
{
   if (base != null)
   {
      Vector angularVelocity( ROTATION_PITCH, ROTATION_HEADING, ROTATION_BANK);
      angularVelocity /= PI;
      base.SetAngularVelocity( angularVelocity);
      base.SetLinearVelocity( Vector( 0, 0, 0));      // make sure we stay put
   }
   else
   {
      if (rotationVar != 0)
      {
         if (rotateAxis == 0)
            object.GetCurMatrix().Rotate( rotationVar * seconds, ROTATION_PITCH * seconds, ROTATION_BANK * seconds);
         if (rotateAxis == 1)
            object.GetCurMatrix().Rotate( ROTATION_HEADING * seconds, rotationVar * seconds, ROTATION_BANK * seconds);
         if (rotateAxis == 2)
            object.GetCurMatrix().Rotate( ROTATION_HEADING * seconds, ROTATION_PITCH * seconds, rotationVar * seconds);

         object.UpdateCollisionObjectPositions();
      }
   }
}

need a lot of modification still, but that's the general idea. I'll attach what I have so far if you want to play with it some. Its based off the rotating_object.gsl
Logged
BigDaz
Sr. Member
****
Posts: 345


HardCore


View Profile
« Reply #18 on: May 10, 2010, 04:35:10 PM »

I remembered today the original Beyond Virtual car had working front wheels which it used to steer so I think a similar method could be used in this case. Haven't got time to really look at it properly now but I think it's feasible.

Logged
BigDaz
Sr. Member
****
Posts: 345


HardCore


View Profile
« Reply #19 on: May 13, 2010, 05:51:56 PM »

Think I've found an easier way. 
Adding a collision object, attaching it to the appropriate mesh and ticking the 'follow object animation' box does work. I don't think it's capable of picking up a small object like a bomb but it can push crates around.

Is there any way of showing collision objects in game? It'd make testing easier.
Logged
ross.rockafellow
Global Moderator
Full Member
*****
Posts: 142



View Profile
« Reply #20 on: May 14, 2010, 08:54:57 AM »

Ctrl + C will show collision
Ctrl + F will show wireframe
Ctrl + O will show occlusion
Ctrl + X will show X-Ray

X+Ray along with show collision will probably be the best "view" for testing.

Hope that helps =)
Logged
BigDaz
Sr. Member
****
Posts: 345


HardCore


View Profile
« Reply #21 on: May 14, 2010, 09:07:20 AM »

Cool, thanks.
Logged
Pages: 1 [2]
  Print  
 
Jump to:  

 
Powered by MySQL Powered by PHP bluBlur Skin © 2006, hbSkins
Powered by SMF 1.1.14 | SMF © 2006-2011, Simple Machines LLC
Valid XHTML 1.0! Valid CSS!