How do I find/set the current position of my mouse cursor to spawn something at its location, set a waypoint or log a vector 3?
  • It is the raycast node. In the raycast setting, just enable the Use Mouse Position, and change any other settings to your liking.
  • Use a Raycast To Variable node to store the position that was hit by the raycast into a Vector3 variable, e.g. using the Screen ray origin and enabling Use Mouse Position is usually a good setup for getting the position of the cursor in the game world.

    Afterwards, use the stored position from the variable to spawn the prefab.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks guys, and would you recommend casting from the 'Head' child object? Also, I'm curious whether there's any difference between Move and General events apart from Move events not requiring a 'Global' designation in order to be called.
  • Depends on the specific use case - e.g. if it's for a 'point and click' style, I'd use the Screen ray origin, if it's for a weapon shooting, use either that or set up a child object on the combatant's prefab (or whatever is used) as origin.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks! What about options for 'Speed Smoothing', such as is available for mouse controls, or for setting an alternate spot to place a waypoint if coordinates are blocked? I know you can avoid registering a click based on the navmesh layer, but I'd like to create a set of formations for party followers, which will need to reposition according to the placement of obstructions surrounding a primary waypoint.
  • Hm, obstacles could be handled by another raycast (e.g. before the position finding raycast) to check other layers if there's an obstacle.

    Speed smoothing depends on where to use it - e.g. using a Change Position node with fading has interpolation options to smooth the movement.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • "Speed smoothing depends on where to use it - e.g. using a Change Position node with fading has interpolation options to smooth the movement."

    -I don't see a fading option anywhere on the change position node.
  • There should be a "Move" Checkmark towards the bottom, check that and it'll open up a bunch of options including an interpolation type.
    Warborn
  • @Wrofir "There should be a "Move" Checkmark towards the bottom, check that and it'll open up a bunch of options including an interpolation type."

    Yes, and thank you. I always use that node with 'Movement' checked, but I don't see a 'Fading' option. The options I find under 'Movement Settings' are:

    -Move

    -Ignore Height Distance

    -Controller Move

    -Apply Gravity

    -Face Direction

    -Stop Distance (wish this could be set to a formula)

    -No Combatant Radius

    -***Move By Speed*** (Always checked. Seems the only plausible option for most circumstances, unless I misunderstand the 'Move By Time' feature.)

    -Secure Move

    -Stop At Target

    -Speed Type (wish there could be more than 3, but 3 works)

    -Speed (would also be very useful to link a formula to. Infinite speed types!)

    -Follow Position

    And that's all. Of course, moving by time offers an option for interpolation, but that's no use to me. In any case, I stand by my original story that 'Fading' doesn't appear to list as an option.



  • So i think you do actually uncheck move by speed, might be wrong though. Because move by time interpolates based on how many seconds it takes where as move by speed uses your nav-mesh (or whatever movement that object defaults to)

    Move by time would be : 1 second, Ease in-out quad
    or something.
    Warborn
  • Thanks, and I was afraid that might be the case. Also, playing around a little, it appears I have indeed misunderstood the feature. Or, rather, I simply don't understand how 'Move By Time' works. Setting it to various different values (1, 0.5, 2, 1.35 etc.) changes movement speed according to the initial distance between 2 points, but it doesn't time out or adjust travel speed to ensure that movement between 'X' and 'Y' concludes within an allotted time frame. Maybe it sets a maximum speed based on some algorithm, but it's hard to tell. Hopefully @gamingislove has an answer.
  • edited June 28
    I think the only way is to use a Nav Mesh since you're looking for a specific formation and obstacle avoidance. Setting a "Nav Mash Target" to a specific formation point with, I think, Secure Move turned on to ensure they will eventually give up if the location isn't valid/blocked off. But I guess that depends on what type of gameplay/movement you're looking for.

    So far setting a "Nav Mesh Target" has solved a lot of movement issues for me, for combatants.
    Post edited by Wrofir on
    Warborn
Sign In or Register to comment.