Announcement

Collapse
No announcement yet.

Can someone please help with getting an actor reference from an array based on location?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    You can have 100^100 custom meshes set to hidden in game with custom collision that still provide reaction via code.

    Basically you literally just add another capsule component and set the collision settings to overlapp all.
    It wont affect the mesh collision for the tree either, which should be handled with simple collision within the FBX and automatically made part of the mesh.

    Performance wise it may be best to utilize the in engine shapes and components, but if you keep your custom collision mesh simple, and if you swap the normals around, you wont even see the mesh anyway (except it costs to try to render so actually hide it).

    Leave a comment:


  • replied
    MostHost LA But how do I check for the meshes overlap then? If I just give it two different collisions how could I differentiate between one and the other? I don't want players to be able to walk through the fallen trees but I could just add a larger capsule component to the base mesh.

    Leave a comment:


  • replied
    "The problem is it all falls apart if the player moves and makes a different cut"

    I would change the code so that it doesn't check for location, but disables the whole BP on End Overlap of a player class.

    However, if you really want to keep track of locations, the best way is to use this system here
    https://docs.unrealengine.com/Images...nd_Overlap.jpg
    doc page:
    https://docs.unrealengine.com/en-US/...ace/index.html

    Read on, or rather implement it, or better yet, look at the content example. it becomes clear how it tracks position over time.

    That said, it's stupid expensive when the location on the log doesn't really matter to you. you have the log. if the character is anywhere within it (custom capsule collision covering it) you allow the chop. the moment the character walks off you stop the chop, start a timer for dissolving/removing.

    it should be more then what you need. though maybe the issue is actually on the instanced mesh re-spawning side?

    Leave a comment:


  • replied
    MostHost LA Yeah that's basically what it is. I would just have the fallen log be it's own bp but I'm trying to save on resources and there are many ingame events that could cause a tree to fall and turn into a log outside of player control. So I want to keep using hisms to cut down on draw calls. So I spawn a bp actor that isn't visible on location of the log and get the player interaction with the hism added to that, it works if the player doesn't move and the sphere picks up everything's location.


    The problem is it all falls apart if the player moves and makes a different cut, goes to a different log or anything else really. I need the sphere overlap actors to be nixed as it doesn't allow logs that are close together to be chopped and it never fully covers the log allowing players to keep spawning in. Somehow need the overlap actors to be with the hisms collisions.

    Leave a comment:


  • replied
    @NotSoAccurateNo1 thats the problem, I don't know how to reference the hism.


    It's tracking the players actions on specific hisms, this time a fallen log. So when a player "cuts" a log it will spawn a bp actor that would spawn the amount of wood after the cut is done. Buuut it does a sphere trace to detect where the log hism, cut actor, and player are. If a cut wood actor isn't on the log it will spawn a new one but the player can just walk to a different portion of the log and make a new cut.


    But the new cut should increment off the one already spawned. And then it should destroy the hism and itself when the log is all the way chopped. I can't figure out how to trace along the hisms collisions or something because a sphere will never fully cover the log unless it's big, but what if there are multiple fallen logs in this sphere? Then you can't chop the other ones since it will _always_ detect a chop wood actor.



    I don't know how to keep the reference I attempt to add it to an array but the player can just chop a tree walk to a different one and do it again ad infinitum. So I'll never know what the location, or index of the hism is. SO I need to get by location, except the only way is a sphere overlapping actors which is terrible as it has huge drawbacks.

    Leave a comment:


  • replied
    So, to recap, the issue is that the log is being cut again after it already has been cut in that same location. Correct?

    Thinking out of the box a little with some pseudo code.

    Player cuts instanced tree.
    Instance of foliage removed.
    BP of falling log spawned.
    Hit events on spawned log kept track internally to the log BP.

    Because no instance is avaliable at this location theoretically following that pseudo code logic you wouldn't be able to re-spawn a log.

    If this doesn't help, could you give us a visual representation (a short video) of the issue? For clarity and brevity...

    Leave a comment:


  • replied
    Been out of the forum for a while. Can you keep a reference of both the instance of the hism and the blueprint spawned for actions at the same time that you begin those actions? That way when you cancel you just use those references. Interface communication preferable.

    Leave a comment:


  • replied
    ClockworkOcean I think this went right over my head, why would I instance a bp if I don't get the benefit, I don't understand? Cause then the hisms are better, no?
    Last edited by PerCat; 11-18-2019, 04:14 PM.

    Leave a comment:


  • replied
    PerCat Like this. But you don't get the benefits of instancing, not possible of course:



    Attached Files

    Leave a comment:


  • replied
    MostHost LA sorry but I think you may have misunderstood my question a little. The resources wouldn't move any, I already have it working mostly I just can't re-get the reference after the blueprint runs the first time. So after a tree has been chopped and it has fallen to the ground(some fancy particles play and it's swiped out for a log HISM), the player then interacts again to chop wood from it. This is where my struggle is, it will do a sphere trace(lets say 100) to detect if it has already spawned a cut log event, but the sphere trace doesn't cover the whole log if its 300 long, so then it will spawn another at the new hit location.

    I need the function to trace the instances collision? Like a begin overlap, but, it would be callable? Some sort of way to get a trace the exact size and shape of the instances collision, I just don't know if that's actually possible.

    Leave a comment:


  • replied
    Originally posted by ClockworkOcean View Post
    PerCat Did you know you can instance BPs like foliage now? ( maybe that's relevant )...
    How does that work? I honestly didn't know you could... I thought each individual bp would be a draw call?

    Leave a comment:


  • replied
    Aside from the fact you can instance BP with foliage since I think .19 or .20.
    The way you are going about it and how you frames this question is just odd.

    If you want an event to stop whatever it is based on distance, create an appropriately large shape and detect the End Overlap event to put a stop to whatever interaction was occurring.

    You definitely will not find a way to get a reference based on location since location is always updating and even with an array map you have nothing that is constantly updating the data to keep track of the location. The overhead for that is probably almost as bad as not using instances (depending on number of actors your would have to trace to).

    If you really cant use instanced blueprints, the best way would be to spawn a custom invisible mesh to use for the overlap detection. You just spawn it around the character, and use it to determine when/if the player exits the area via the same end overlap.

    Leave a comment:


  • replied
    PerCat Did you know you can instance BPs like foliage now? ( maybe that's relevant )...

    Leave a comment:


  • replied
    Well think of this "project" as some sort of mix between rts and rpg, each player controls a small group of pawns and they compete for resources/objectives. The levels are fully random with the host deciding how it's all generated. There can be thousands of trees or 6, or anything inbetween.


    So using instances on this is my best bet to save on draw-calls for resources. A bp that would switch out would work alright but potentially could be lots of draw calls, depending on how the players play. And there is a lot of level events that are already in place that would make that switch suck as I would have to rework quite a bit to have it work with instances and bps.


    So I can but it would suuuuck, so I'm really hoping what I'm trying to do is possible, but idk cause of how difficult it seems to be so far.

    Leave a comment:


  • replied
    PerCat I've only skim read this, so maybe I'm way off target, but: Why not make the tree a BP which can handle animating it's 'downfall' in response to a BP interface call?

    That way you don't have to manage separate objects, you just have to keep sending the tree BP the interface call.

    Leave a comment:

Working...
X