Git Product home page Git Product logo

ue4-targetsystemplugin's Introduction

Target System Plugin

Supported engine versions: 5.1, 5.2, 5.3 (as per latest release)

An UE4 plugin written entirely in C++ which adds support for a simple Dark Souls inspired Camera Lock On / Targeting system.

It was first developed and tested in Blueprints following the implementation of the people over at Lurendium, with this tutorial series: Part 1, Part 2, Part 3, and then converted and rewritten into a C++ module and plugin.

Get it from the marketplace or download the latest TargetSystem.zip pre-built plugin zip from the Release page, and drop the content in your project's Plugins folder.

Then, load up Unreal Editor, check the Plugins page and see if TargetSystem plugin is enabled.

Features

  • Customizable with a set of options that can be overridden in Blueprints.
  • Easy setup: only one Actor component to attach and a minimum of one functions to bind to input.
  • Target closest enemy (Pawns by default, customizable with TargetableActors UPROPERTY).
  • Break on Line of Sight when getting behind an object.
  • Break Target when getting outside minimum distance to enable.
  • Simple TargetLockedOn Widget included, can be customized / overridden.
  • Option to control character rotation when locked on.
  • Switch to new target with axis input (on mouse / gamepad axis movement).
  • Two Blueprint implementable events on component on Target Locked On and Off.
  • Adds a Pitch Offset at close range, the greater it is the closer the player gets to the target.

Usage

Check the Setup wiki page to get started, the Configuration to customize the system's behaviour, or Blueprint Functions and Events to learn more on these.

Thanks and Credits

License

MIT License.

ue4-targetsystemplugin's People

Contributors

josator avatar mklabs avatar william-anderson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ue4-targetsystemplugin's Issues

Locked Target while Player Dies causes Unhandled Exception

Fristly - Thank you for this amazing plugin - It's a beautiful thing!.
When I have the target locked and the attacker kills the player (who has the target locked on to the enemy) - the editor crashes with this error:

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000000000001c8

UnrealEditor_TargetSystem!UE::CoreUObject::Private::ResolveObjectHandleNoRead() [Z:\projects\UE_5.2\Engine\Source\Runtime\CoreUObject\Public\UObject\ObjectHandle.h:255]
UnrealEditor_TargetSystem!UTargetSystemComponent::LineTrace() [Z:\projects\UE_proj\EngineSource\5.2\Title\Plugins\TargetSystem\Source\TargetSystem\Private\TargetSystemComponent.cpp:510]
UnrealEditor_TargetSystem!UTargetSystemComponent::ShouldBreakLineOfSight() [Z:\projects\UE_proj\EngineSource\5.2\Title\Plugins\TargetSystem\Source\TargetSystem\Private\TargetSystemComponent.cpp:595]
UnrealEditor_TargetSystem!UTargetSystemComponent::TickComponent() [Z:\projects\UE_proj\EngineSource\5.2\Title\Plugins\TargetSystem\Source\TargetSystem\Private\TargetSystemComponent.cpp:70]
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Core
UnrealEditor_Core
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor_LyraEditor!ULyraEditorEngine::Tick() [Z:\projects\UE_proj\EngineSource\5.2\LyraStarterGame5.2_v0094\Source\LyraEditor\LyraEditorEngine.cpp:39]
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
kernel32
ntdll

image

Function or bool when system is completely off (Target Actor is Toggled off)

Is there a function or bool inside the system to know when the target system is completely toggled off? "On target locked off" fires everytime a target is switched, not when system is off. Same with "is locked".

On component deactivated also never fires. When I am locked on and hit target actor function again, then system "turns off" i need an event or bool for that.

Thanks!

Wrong Collision Channel

Have to change from ECC_Camera to ECC_Pawn.

Was an issue when used in Epic's Action RPG project.

Directional Movement While Only Targeting

I want my character to start having directional movement only when im targeting I know about the "Should Control Rotation" But Im not sure on how to change the animation considering that the plugin is a component so if you could help me with getting the directional movement while targeting that would be great!

Expanded wiki documentation

Fantastic work on this plugin!

I’d like to humbly offer a few potential adjustments to the wiki, made with the overall aim of improving clarity and increasing accessibility for relative newcomers to UE and/or UE plugins (as a recent newbie myself): https://github.com/andrewcreekmore/ue4-targetsystemplugin/wiki

Summary of changes:

Setup
A few typos were fixed, along with the following edits:

Original: “If you start off from the Third Person Template, you can skip this step”

“If your project already starts off from the Third Person Template, or if you simply don't wish to use the provided example Test map, you can skip this step”

Original: “TargetSystemTargetableInterface: A simple interface you can use on your targetable actors to enable or prevent the targeting on this specific Actor. It has a single method IsTargetable which return false by default, and can be overridden to plug-in your custom logic to prevent the targeting for this Actor (like a IsAlive state, or if the health of this character is > 0)”

TargetSystemTargetableInterface: A simple interface you can use on your targetable actors to enable (or prevent) the targeting of this specific Actor. It has a single method IsTargetable which returns false by default, and can be overridden to plug-in your custom logic to prevent the targeting of this Actor (e.g., an IsAlive state being true could cause IsTargetable to return false; the health of the character being > 0 could cause IsTargetable to return true, etc)”

Original: “The first step is to attach the TargetSystemComponent UActorComponent to your Player Character. In the Third Person Blueprint template, you can do so with ThirdPersonCharacter Blueprint.”

“The first step is to attach the TargetSystemComponent UActorComponent to your Player Character's Blueprint. For example, if you used the Third Person Blueprint template, you would attach this component to the ThirdPersonCharacter Blueprint. Click "add component" and search for Target System, then click to select it. It should now appear in your Player Character's list of components, underneath CharacterMovement.”

Original: “By default, the TargetLockedOnWidgetClass is set to the UMG Widget included in this plugin. You can override and extend this Widget or use a custom one.”

“The Locked On Widget is the visual icon that appears over the targeted actor, indicating what the Player Character is currently locked on to. By default, the TargetLockedOnWidgetClass is set to the UMG Widget included in this plugin. You can override and extend this Widget or use a custom one.”

Original: “This step is optional, but lets you further define when and how an Actor should be targetable. It can be handy to prevent the Actor from being targeted if it is dead or depending on another state. First, you should add the interface to the TargetableActors:”

“This step is optional, but lets you further define when and how an Actor should be targetable. It can be handy to prevent the Actor from being targeted if it is dead or depending on another state. First, you should add the interface to the TargetableActors you want to allow the Player Character to target, such as an enemy. To do so, go to that Actor's Blueprint and choose Class Settings, which will change the right-hand Details pane. In this pane, find Interfaces, click Add, and search for and choose TargetSystemTargetableInterface:”

Original: “In this setup, this is simply done on the same ThirdPersonCharacter blueprint, because that's the Actor we're targeting in this demo.”

“In our example, this is being done on the same ThirdPersonCharacter blueprint, because that's the Actor we're targeting in this demo - but typically speaking, this interface is added to non-player characters such as enemies.”

Configuration
A few typos were fixed, along with the following edits:

Original: “float BreakLineOfSightDelay: The amount of time to break line of sight when actor gets behind an Object.”

float BreakLineOfSightDelay: The amount of time (in seconds) after a targeted actor moves behind an Object until line of sight is broken and targeting is lost.”

Original: “bool AdjustPitchBasedOnDistanceToTarget: If enabled, the target system will add an offset to the Pitch for the character's camera rotation at close range. The greater it gets the closer the actor gets to its target. It avoids the issue of the Player Character hiding the target at close range.”

bool AdjustPitchBasedOnDistanceToTarget: If enabled, the target system will add an offset to the Pitch for the Player Character’s camera rotation at close range. The closer the actor gets to its target, the greater the pitch adjusts in order to avoid the common issue of the Player Character hiding the target when at close range.”

targetting without seeing Target

Hi 'im using your plugin § And love it ! i custom it like i want but have an issue, when i'm facing a wall ( no object or stuff between me and target, but not facing the target), and pressing the target trigger , my cam will do a 180 directly to face the target. So i want to know if i missed a param or something to make it if i don't see the target in the camera field of view i can't target it.

thanks in advance !

Includes in .h files can be replaced with forward declarations in most cases

Normally it is better to avoid as many includes as posible in a .h file.

It is better to use a forward declaration instead a .h include in the header file, and then include the .h removed from the header in the .cpp file. for example in the TargetSystemComponent.h file you can remove

#include "GameFramework/PlayerController.h"

and replace it with

class APlayerController;

Then in TargetSystemComponent.cpp you will need to add

#include "GameFramework/PlayerController.h"

https://www.geeksforgeeks.org/what-are-forward-declarations-in-c/

bear in mind that forward declarations are not always possible, but for most cases, ie a pointer variable are enough and improve compilation times by reducing header dependencies.

Nativization results in error

If you attempt a project for inclusive nativization method it returns the error:

UATHelper: Packaging (Android (ASTC)): ERROR: Missing precompiled manifest for 'TargetSystem'. This module was most likely not flagged for being included in a precompiled build - set 'PrecompileForTargets = PrecompileTargetsType.Any;' in TargetSystem.build.cs to override.

And

  1. I have no idea about that stuff,
  2. surprisingly (or not actually) all the googles are blue print users who are clueless like me. you C++ users are jerks for not telling us boooo boooo :p

Local multiplayer

this plugin not work for local multiplayer?
because when with the player two I want focus is the player 1 who focus.

Can't lock on unless directly facing

When using the plug-in, I am unable to lock on to the enemy AI unless I am facing directly at the AI. Is this is the desired result? I'd like to be able to not be facing with my character and lock on to the AI, only having the camera face the AI and trigger the lock on.

Offset

Hi can anyone add a left, right offset please i have tried using paid lock on plugins and they are not that good, this one works perfect but i need to have a left right offset like the way it has up/down for my project to work properly thanks.

Rotation to target

Hello. Thank You for plugin. Trying on 4.21. Targeting works, scrolling between targets too, but i can not turn off "rotation to target". I unchecked in component, even made key input flip/flop that should change that bool inside component, but in my case, "look at target" mode is On all the time. What could be my mistake here? Thank You.

Delete this

I created an issue, but It was my fault. Please delete this issue.

ShouldControlRotation doesn't work

Hey,
Whenever I try to unlock rotation (such as sprinting and rolling) it won't unlock. i tried even linking the boolean change to Event Beginplay and it doesnt affect anything. When changed within the component itself it works, but it wont change within blueprints. I'm trying to change it from the Target System component within the blueprints, can anyone help?
image

Enable Camera Rotation

Hello, is there a way to enable camera rotation while targeting. Is this already in the component or is it still in development. Thanks

[Question] Return object aimed at and moving camera

Hi! First of all, thanks for the amazing plugin and how well it's done!

I was trying it on 4.22 and was trying to do two things that I'm not sure if the plugin allows, is it possible to get the target you're aiming to? Like have a return value that is the target of the plugin or similar, and, is it possible to change the angle of the camera so it's not fixed to the target point? To have a more wide area of view or in case some characters are too big or weird and they can't be properly played with when the camera is that way.

Again, thanks for the amazing work and in advance!

Lurendium.com does not exist anymore (possibly source of malware too!)

The "www.lurendium.com" links mentioned in the readme.md are not valid anymore. Following them a first time, I was sent to some website that tried to install an extension/add-on to my browser. The second time, I was redirected to some other website that got flagged by my adblocker as a possible malware source.

Random Crashes (Access violation - code c0000005 (first/second chance not available))

Hey when testing this the editor crashes with the error log below. I'm having a hard time replicating this, it seems destroying a targeted actor can lead to it, but i've also encountered it when exiting and entering the range while targeting an actor. Since i did download it from the marketplace i used your screenshots to replicate the system. (I've just stuck with "pawn" as the targetable actor class.
I'm running it on ue 4.21 and windows 64 bit.

Access violation - code c0000005 (first/second chance not available)

UE4Editor_TargetSystem!UTargetSystemComponent::TargetLockOff() [d:\build++portal+dev-marketplace+full\sync\localbuilds\plugintemp\hostproject\plugins\targetsystem\source\targetsystem\private\targetsystemcomponent.cpp:267]
UE4Editor_TargetSystem!UTargetSystemComponent::TickComponent() [d:\build++portal+dev-marketplace+full\sync\localbuilds\plugintemp\hostproject\plugins\targetsystem\source\targetsystem\private\targetsystemcomponent.cpp:73]
UE4Editor_Engine!FActorComponentTickFunction::ExecuteTickHelper<<lambda_3709318d6805ded621dc256d05754a1f> >() [d:\build++ue4\sync\engine\source\runtime\engine\classes\gameframework\actor.h:3143]
UE4Editor_Engine!FActorComponentTickFunction::ExecuteTick() [d:\build++ue4\sync\engine\source\runtime\engine\private\components\actorcomponent.cpp:800]
UE4Editor_Engine!TGraphTask::ExecuteTask() [d:\build++ue4\sync\engine\source\runtime\core\public\async\taskgraphinterfaces.h:829]
UE4Editor_Core!FNamedTaskThread::ProcessTasksNamedThread() [d:\build++ue4\sync\engine\source\runtime\core\private\async\taskgraph.cpp:679]
UE4Editor_Core!FNamedTaskThread::ProcessTasksUntilIdle() [d:\build++ue4\sync\engine\source\runtime\core\private\async\taskgraph.cpp:586]
UE4Editor_Engine!FTickTaskSequencer::ReleaseTickGroup() [d:\build++ue4\sync\engine\source\runtime\engine\private\ticktaskmanager.cpp:573]
UE4Editor_Engine!FTickTaskManager::RunTickGroup() [d:\build++ue4\sync\engine\source\runtime\engine\private\ticktaskmanager.cpp:1474]
UE4Editor_Engine!UWorld::RunTickGroup() [d:\build++ue4\sync\engine\source\runtime\engine\private\leveltick.cpp:783]
UE4Editor_Engine!UWorld::Tick() [d:\build++ue4\sync\engine\source\runtime\engine\private\leveltick.cpp:1473]
UE4Editor_UnrealEd!UEditorEngine::Tick() [d:\build++ue4\sync\engine\source\editor\unrealed\private\editorengine.cpp:1726]
UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [d:\build++ue4\sync\engine\source\editor\unrealed\private\unrealedengine.cpp:403]
UE4Editor!FEngineLoop::Tick() [d:\build++ue4\sync\engine\source\runtime\launch\private\launchengineloop.cpp:3699]
UE4Editor!GuardedMain() [d:\build++ue4\sync\engine\source\runtime\launch\private\launch.cpp:174]
UE4Editor!GuardedMainWrapper() [d:\build++ue4\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:145]
UE4Editor!WinMain() [d:\build++ue4\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:276]
UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283]
kernel32
ntdll

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.