3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: Trouble with projectile object.  (Read 75 times)

« on: June 03, 2014, 04:54:48 AM »
I wanted to implement multiple cannons into my sail boat project. I figured that having multiple projectile objects in the project was needlessly innefficient. Instead, my plan was to have a single projectile object, that was moved around the ship and started four times in succession (for the groups of guns on either side of the ship).

For example:

Code: [Select]
      iObjectChildTransform(OBJ_0,OBJ_264,gunrot[0],gun[0]);
      iObjectStart(OBJ_264);
      iObjectChildTransform(OBJ_0,OBJ_264,gunrot[0],gun[1]);
      iObjectStart(OBJ_264);
      iObjectChildTransform(OBJ_0,OBJ_264,gunrot[0],gun[2]);
      iObjectStart(OBJ_264);
      iObjectChildTransform(OBJ_0,OBJ_264,gunrot[0],gun[3]);
      iObjectStart(OBJ_264);

gunrot[0] represents the orientation for the left-hand guns, and gun[1,2,3] represent the locations of the four guns.

However, when I run this section of the script, the projectile object is only started once. I am guessing that it doesn't react well when started multiple times in succession?

Anyway, I was wondering if there was a way to fix this, or if there was a way to add a delay before each 'iObjectStart' command.

Do you guys have any thoughts?
« Reply #1 on: June 03, 2014, 05:39:54 AM »
However, when I run this section of the script, the projectile object is only started once. I am guessing that it doesn't react well when started multiple times in succession?

Almost correct.

The actual scene isn't updated until the loop of the script is finished.

So, for example, this script:

Code: [Select]
void Main()
{
   iObjectHide(OBJ_x);
   iObjectShow(OBJ_x);
}

...Won't give a blinking object. I'll just be a hidden object.

To achieve what you want, you'd be better of using imposters and iImposterVelocitySet(). Doing this, you'll avoid a lot of extra object and script-linkings.
Rocket Rumble, a 3D Rad puzzle game:
http://www.3drad.com/forum/index.php?topic=9896.0
« Reply #2 on: June 04, 2014, 03:49:48 AM »
Thanks for clearing that up for me Robertoo. I've ended up using your suggestion about the imposters and iVelocitySet. It works really well.

Cheers,

G
Pages: [1]