playMaker

Author Topic: Simple action for ray cast  (Read 10294 times)

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Simple action for ray cast
« on: November 21, 2011, 12:17:27 PM »
I think playmaker should have a ray cast action more compatible with users
Because the normal ray cast action is very complex
Bye

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Simple action for ray cast
« Reply #1 on: November 29, 2011, 08:24:52 PM »
What features would you want in this simplified raycast action? Something to just raycast forward maybe...?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Simple action for ray cast
« Reply #2 on: November 30, 2011, 01:12:53 AM »
Hi,

 The problem with raycast is that it's quite an intensive task and therefore requires a very careful set up to keep your frame rate ok. Simplifying means having to compromise on this one way or the other. the distance is very important, the repeat option is equally just as important, and so is the layer set up... difficult to find a way to simplify this...


uhm, unless we could tag actions as "performance hit" and playmaker would alert somehow in its interface that some actions are not necessarly the ideal way to get the best performance. Because user would certainly face one day a performance problem if using simplified features and could blame playmaker for it.

 The other issue would be the way the playmaker interface for the action is defined. It's "fixed" and can not be changed based on the user input. Let's say we would put an "expert" check box in the raycast action and if the user click check it we show the full set of feature, else we show a cut down version with a warning "not optimized" or something.
 
 Maybe have a plain english description for the direction "forward" "up" "right", "backward", "down", "left", and have in the tooltip the relation between each description and their axis (x,, -x etc etc). This is maybe where the confusion comes from.

Bye,

 Jean

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Simple action for ray cast
« Reply #3 on: November 30, 2011, 05:37:39 PM »
What features would you want in this simplified raycast action? Something to just raycast forward maybe...?

Yes Alex and I would like PlayMaker have more videos free on You Tube
Bye

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Simple action for ray cast
« Reply #4 on: November 30, 2011, 05:40:05 PM »
Hi,

 The problem with raycast is that it's quite an intensive task and therefore requires a very careful set up to keep your frame rate ok. Simplifying means having to compromise on this one way or the other. the distance is very important, the repeat option is equally just as important, and so is the layer set up... difficult to find a way to simplify this...


uhm, unless we could tag actions as "performance hit" and playmaker would alert somehow in its interface that some actions are not necessarly the ideal way to get the best performance. Because user would certainly face one day a performance problem if using simplified features and could blame playmaker for it.

 The other issue would be the way the playmaker interface for the action is defined. It's "fixed" and can not be changed based on the user input. Let's say we would put an "expert" check box in the raycast action and if the user click check it we show the full set of feature, else we show a cut down version with a warning "not optimized" or something.
 
 Maybe have a plain english description for the direction "forward" "up" "right", "backward", "down", "left", and have in the tooltip the relation between each description and their axis (x,, -x etc etc). This is maybe where the confusion comes from.

Bye,

 Jean

Yah the axis are a bit confusing

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Simple action for ray cast
« Reply #5 on: December 01, 2011, 01:43:10 AM »
Ok,

 I have made a new version of the raycast  ( RayCastFromGameobject ) that has few mods:

1: It only takes a gameObject to shoot the ray from
2: The direction is in plain english ( Forward, Up, Down, etc etc), the tooltip indicates which axis it relates from in case you wanna know for sure.
3: The default value for repeat is 5. I think the main source of misusage is the fact that it's set to 0 by default and therefore fire only onces and done. I am sure that most users struggled with that one when first playing with the raycast action ( i did at least :) ), so I set it by default to 5, which means: it fires once every 5 frames. It's enough for most usage ( perf vs needs) and ensure that the actions works as is when you drop it on a state.

Hopefully this is enough to get a better experience using raycast inside Playmaker ( doesn't take away the fact that more example and screen cast is needed). If you feel that some other areas can be improved, let me know and I'll see what I can do.

[EDIT]
The script I attached to this post was faulty, I have created a proper post with a working version. The custom action is available on this thread: http://hutonggames.com/playmakerforum/index.php?topic=900.msg3685#msg3685


Bye,

 Jean
« Last Edit: December 07, 2011, 05:11:57 AM by jeanfabre »

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Simple action for ray cast
« Reply #6 on: December 01, 2011, 04:27:49 PM »
Very thanks Jean I will try it
Thanks
Bye

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Simple action for ray cast
« Reply #7 on: December 02, 2011, 12:03:07 PM »
I have been studying but I can make a bullet hole on my colliders
Have have this
Please help me
Cheers

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Simple action for ray cast
« Reply #8 on: December 03, 2011, 08:19:35 AM »
Please help me

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Simple action for ray cast
« Reply #9 on: December 03, 2011, 01:30:49 PM »
You need to set the position and rotation of the created object.

Use GetRaycastHitInfo:
https://hutonggames.fogbugz.com/default.asp?W491

And store the position and normal of the hit point in Vector3 variables. Then use those in Create Object.

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Simple action for ray cast
« Reply #10 on: December 03, 2011, 05:32:42 PM »
I have put GetRaycastHitInfo in a state and Create Object in another state
Now I have this
Thanks for any help

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Simple action for ray cast
« Reply #11 on: December 04, 2011, 05:45:09 PM »
Please help me

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Simple action for ray cast
« Reply #12 on: December 04, 2011, 07:13:34 PM »
Make 2 variables: HitPoint and HitRotation.
Use HitPoint for the position and HitRotation for the rotation.

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Simple action for ray cast
« Reply #13 on: December 05, 2011, 03:55:50 PM »
Variables?? it donĀ“t exist on PlayMaker
Do you min Vector3 I have put them but it continues not working
Thanks for any help
Bye 

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Simple action for ray cast
« Reply #14 on: December 07, 2011, 05:03:36 AM »
Hi,

 Have a look at this post, it explains how raycast can be used with a step by step explanation.

http://hutonggames.com/playmakerforum/index.php?topic=725.msg3686#msg3686

Bye,

 Jean