playMaker

Author Topic: Spherecast option for Raycast  (Read 8603 times)

doppelmonster

  • Full Member
  • ***
  • Posts: 157
    • Grinder Games
Spherecast option for Raycast
« on: April 15, 2013, 05:01:54 AM »
Im working on a billard like game and im missing the ability to do a Spherecast.

It would be great if the Raycast action just would get an additonal Radius option to set.

Unfortunateley im not good enough at coding to do it myself....

Thanks,
Matthias

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Spherecast option for Raycast
« Reply #1 on: April 15, 2013, 08:23:36 AM »
Are you just trying to get the size of the object? There are lots of ways to get around not having the spherecast return the radius, you could manually add a variable on those objects for instance, or get scale and manipulate that number.

Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

doppelmonster

  • Full Member
  • ***
  • Posts: 157
    • Grinder Games
Re: Spherecast option for Raycast
« Reply #2 on: April 15, 2013, 09:54:08 AM »
Hi,
I need to check if there is a free way between balls and holes on a pool table. In that way i need a raycast with the thickness of the balls (whenn a ball is only a little bit in the way the raycast will not recognize that, but spherecast will.).

the only solution i can think of with raycast is shooting 3 rays . first from the center, second and third from the outer bounds of the balls. But this will complicate my FSM to much. The other solution might be to create a capsule trigger along the ray of the raycast....

But this is all very clumsy in comparison to a simple spherecast in my opinion.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Spherecast option for Raycast
« Reply #3 on: April 15, 2013, 10:02:02 AM »
Makes sense. It would definitely be handy then.

Alternatively you could just fire an empty gameobject with a sphere collider on it toward the hole(s) and collect any collision information to bool's for clear/not clear. This would be clunky if you were actively moving the projection angle.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Spherecast option for Raycast
« Reply #4 on: April 16, 2013, 01:11:17 AM »
Hi,

 is it not actually a sweep test you want to perform? if you look at the doc, sphere cast will ignore colliders set to trigger, I am willing to such action, but I need to make sure you understand this limitation.

http://docs.unity3d.com/Documentation/ScriptReference/Physics.SphereCast.html
http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody.SweepTest.html

bye,

 Jean

doppelmonster

  • Full Member
  • ***
  • Posts: 157
    • Grinder Games
Re: Spherecast option for Raycast
« Reply #5 on: April 16, 2013, 04:33:50 AM »
Hi Jean,
i checked the docs. In my situation either would work fine. For simplicity i thought it would be easier to turn a raycast action into a spherecast action.

As i am testing balls, a spherecast would work well. That triggers are ignored is more a feature than a problem for me (in my special situation).

Sweeptest:
The Main advantage i see is that you could use any form of collider (also mesh collider) to sweep.

Would it be possible to use layer masks similar to raycast in a sweeptest?
This is a must have!

cu,
matthias

P.S. i have another request which is going in a similar directon. I need the "Trigger Event" Action to test only one frame and then leave the action, even when there is no collision. In the moment you are stuck in the action until a collision happened. So a "every frame" option would be nice.

 
« Last Edit: April 16, 2013, 01:53:44 PM by doppelmonster »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Spherecast option for Raycast
« Reply #6 on: April 17, 2013, 02:21:02 AM »
hi,

 can you make your pas as another thread, I'll reply, else it will make threads complicated and difficult to follow.

 I am working right now on the spherecast action, should be available in few minutes.

bye,

 Jean

doppelmonster

  • Full Member
  • ***
  • Posts: 157
    • Grinder Games
Re: Spherecast option for Raycast
« Reply #7 on: April 17, 2013, 02:34:02 AM »
You are great!
Just opened another thread.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Spherecast option for Raycast
« Reply #8 on: April 17, 2013, 02:57:44 AM »