HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: FX Collidable and Collision Groups  (Read 1381 times)

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
FX Collidable and Collision Groups
« on: Sep 07, 16, 08:49:16 PM »

I can not get models in FX's to fire for _FxEventOccurance when a collision is detected.

In the FX i have the collision set to true, physics instance 1, and saving the collisiongroup field never saves for me.

Am I doing something wrong?
http://i.imgur.com/h1mSdeQ.png

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: FX Collidable and Collision Groups
« Reply #1 on: Sep 08, 16, 04:17:42 PM »

there are alot of IFs dealing with the FX editor.. there are alot of options that no longer are valid, yet are still in the editor.. these are being dealt with in the planned upgrades for the engine.

ONe of these is the collision group.  this now has a default setting and anything you enter into that field will be ignored.  Its stated on the wiki and in HSL but the setting still remains there...

What you're trying to do cant be done via a purely FX method.  Its accomplished via a combination of an FX and customized code in the onEvent function for the fx events.

You wont use any transforms/arcs etc to do it.

That doesnt answer you question, however I wanted you to know we're looking at some possible solutions for you.
I have several methods i use for projectiles (arrows/catapult bolders that explode on impact etc) but... til now none of these use the FX system.  In checking this out for you ive made some discoveries so.. bear with us, when I have something that works consistently i'll write it up for you here.

It involves catching the projectile event, and turning that model into a dynamic object and setting the proper fields for it in HSL (velocity direction etc).  There seems to be an issue with the physics system not consistently activating the dynamic object on creation so.. thats what we're looking into.

Its an interesting find, due to your question :)  so anyway, will get back to you as soon as possible.

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
Re: FX Collidable and Collision Groups
« Reply #2 on: Sep 09, 16, 12:38:10 AM »

You can log into my world, create a new character
type /nocake loadout
press B to open your bag
Double click the green paper to learn fireball
Double click the staff to equip it
Press L and drag the Fireball Ability to your Bar
Click to Cast it and watch console. (you may have to click a second time to release the spell)

You can also check out ProjectileDataClassMethods on the clientside for my event catcher.

Collision event never invokes. I have tried everything.

FX used is #2 Fireball

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: FX Collidable and Collision Groups
« Reply #3 on: Sep 09, 16, 12:52:36 AM »

Quote
What you're trying to do cant be done via a purely FX method

Clarification: the collision event is only registered for particles, not for models.
solid meshes have to be dealt with as you would a DRO as far as collision goes.

Collidable means the fx system will listen for collision events, but again, only the particle system will generate such events.  This sort of thing (using solid meshes in FX) is one of the major gaps in the wiki.

we handle this sort of thing with a raycast that can detect any collision and at what position it will take place when the object / projectile is within acceptable range.

I have 3 or 4 currently implemented systems for this type of thing(basically every way possible currently) depending on the action and situation, however you bringing this up caused us to see if there was in fact a way to utilize the FX system to cut down on some of the coding involved, and it looks like it might be possible which is what we're looking into.

However, i can say that it cannot be done with an FX alone and if the object/projectile is instantiated via the FX it will need to be dynamic and have a valid physics Node ID as its physics instance.  At that point, whats being tested, is the ability to trigger the velocity/direction of the object via catching the OnSTART event for the "Projectile".
So far, its not consistent using the FX method.


Edit: Correction, it does not "Have" to have to use a Physics Node and the initial model can be instantiated in the FX as a Kinematic or other, but the properties of the object "will have to be set via  the ONFXSTART event in HSL to a dynamic object, with the linear/angle velocity of your choice.

While we do have a somewhat functioning version of this.. its not much of a shortcut from the purely scripted methods of doing this. 

We can answer the initial questions regarding collision however:
collision group field is not longer used, was deprecated a long while back
Quote
method SetupNewInstance(newInstance as NodeRef of Class HBNode)
  newInstance["PhysicsType"] = me._fxPhysicsType
  SetNodePosition(newInstance, me._fxPosition)
  SetNodeRotation(newInstance, me._fxRotation)
  SetNodeScale(newInstance, me._fxScale)
  newInstance["Collidable"] = me._fxCollidable
  newInstance["DiffuseColor"] = me._fxDiffuseColor
  newInstance["AmbientColor"] = me._fxAmbientColor
  newInstance["PhysicsInstance"] = me._fxPhysicsInstance
  newInstance["PhysicsDensity"] = me._fxPhysicsDensity
  newInstance["PhysicsShape"] = me._fxPhysicsShape
  // newInstance["PhysicsCollisionGroup"] = me._fxPhysicsCollisionGroup this property is no longer in use
  newInstance["PhysicsLinearVelocity"] = me._fxPhysicsLinearVelocity
  newInstance["PhysicsAngularVelocity"] = me._fxPhysicsAngularVelocity
  newInstance["PhysicsWakeUpCounter"] = me._fxPhysicsWakeUpCounter
  newInstance["PhysicsLinearDamping"] = me._fxPhysicsLinearDamping
  newInstance["PhysicsAngularDamping"] = me._fxPhysicsAngularDamping
  newInstance["PhysicsMaxAngularVelocity"] = me._fxPhysicsMaxAngularVelocity
 
.
Quoted from one of the several HE scripts that used to make use of this field.
It was deprecated in 2012 in the first update that year.

There is no accessible collision detection available for non character models (exception of particles) via HSL.
Using RayCasting or other custom methods is the only option right now, as this is an expensive process.  The physics system handles collision for Dynamic objects but this was never made accessible via HSL, instead the Raycast and RayCast3D external functions are provided to detect collision. 

I'm only assuming here, correct me if i'm wrong, but it seems you have the FX setup so that if the projectile collides with something, the explosion fx will take place.  if so, you could shoot a raycast prior to triggering your fx, and if theres an intercect (collision) use that point as your target, then call the explosion/fireball fx at the ONFXSTOP event of the projectile.. just one suggestion.
« Last Edit: Sep 09, 16, 02:32:49 AM by ToY-Krun »
Logged

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
Re: FX Collidable and Collision Groups
« Reply #4 on: Sep 09, 16, 12:04:36 PM »

I have many different ways I handle this.

Currently I sample the FX's location and then raycast from there.
Store that position and wait for the next tick. (perframe or timer not entirely sure yet)
Then on next tick raycast from the last point to the new point to see if it collided with anyone.

I would much rather have the model of the FX have collision detection like the particles.

I guess I will test having 1 giant particle, I have not looked into it much yet but the particles do collide with hieghtmap, players, models, speed trees, and other particles correct?
« Last Edit: Sep 09, 16, 12:46:07 PM by nocake »
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: FX Collidable and Collision Groups
« Reply #5 on: Sep 09, 16, 09:57:31 PM »

Quote
I guess I will test having 1 giant particle, I have not looked into it much yet but the particles do collide with hieghtmap, players, models, speed trees, and other particles correct?

yep, you could check out the bouncing drops in the example areas if you need to see how the particle needs to be setup for collision.