About Store Forum Documentation Contact



Post Reply 
Actor
Author Message
Barthap Offline
Member

Post: #1
Actor
Stupid problem:

How to add actor to Bullet class from Bloody Massacre? I tried do it but there was strange effects. I need it to collision with Dsestructible objects.

This is my Bullet::Set() method:
Code:
void Bullet::set(C Vec &pos, C Vec &dir, Chr *owner)
{
   T.matrix.setPosDir(pos,dir);
   T.vel  =dir*60;
   T.vel *=2;
   T.owner=owner;
   T.dir = dir;

   Vec pos_old=matrix.pos; matrix+=vel*Time.d();
   Vec pos_new=matrix.pos;
   actor.create(Capsule(R, pos_old, pos_new)); //I tried making Ball or other capsule parametrs, effect was worse
   actor.pos(pos); //Tried with pos_new and pos_old
   actor.vel(vel); //tried addVell() too
}

How to add actor correctly?
12-22-2010 08:13 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Actor
remember that the actor may collide with the player, so you need to disable player collisions.
also it can be affected by gravity, damping, not sure if PhysX has some limitations for max velocities. Also make sure to enable CCD (continuous collision detection)

Other idea:

Instead, using the old method after detecting collision of bullet (when it hits the target), you can manually detect any nearby objects, and break them apart, or manually apply velocities.
12-22-2010 04:54 PM
Find all posts by this user Quote this message in a reply
Barthap Offline
Member

Post: #3
RE: Actor
I tried second idea, but it destroys object. My method can detect, which actor of destructible mesh is collided and destroy not full mesh but only this actor (part of destructible mesh), which hit my bullet.

How to disable collision with for example player (or other specified actor)? I can turn off gravity, damping itp but I can't do that. :(
(This post was last modified: 12-22-2010 05:24 PM by Barthap.)
12-22-2010 05:17 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Actor
bullet.actor.ignore(player.ctrl.actor)
12-22-2010 05:33 PM
Find all posts by this user Quote this message in a reply
Barthap Offline
Member

Post: #5
RE: Actor
Ok, my code:

Code:
void Bullet::set(C Vec &pos, C Vec &dir, Chr *owner)
{
   T.matrix.setPosDir(pos,dir);
   T.vel  =dir*55;
   T.vel *=2;
   T.owner=owner;
   T.dir = dir;

   Vec pos_old=matrix.pos; matrix+=vel*Time.d();
   Vec pos_new=matrix.pos;

   Physics.ccd(true);
   actor.create(Capsule(R, pos_old, pos_new));
   actor.damping(0);
   actor.ignore(Players[0].ctrl.actor);
   actor.gravity(false);
   actor.pos(pos);
   actor.vel(vel);
}

Some images: http://img574.imageshack.us/gal.php?g=77235093.jpg
12-22-2010 05:57 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Actor
physics.ccd is on by default, I meant actor.ccd

also you can decrease actor capsule length, with this length it can collide with objects behind the actor.
12-22-2010 06:01 PM
Find all posts by this user Quote this message in a reply
Barthap Offline
Member

Post: #7
RE: Actor
yes, if I increase velocity, actor length will be increased too. I changed it and added actor.ccd(true) but it's the same effect.

Collision is only on 2-5m distanse from player.
12-22-2010 06:10 PM
Find all posts by this user Quote this message in a reply
Post Reply