Code Monkey home page Code Monkey logo

Comments (2)

VonHirsch avatar VonHirsch commented on July 20, 2024 1

Sounds good. Incidentally, I got it working in C++, I had missed the step to set the StartLocation of the SpawnedActor instance after calling WaitTargetData.

	// Get Player & Show HUD Message
	AXBZTGasSandboxCharacter* Player = CastChecked<AXBZTGasSandboxCharacter>(ActorInfo->AvatarActor.Get());
	Player->ShowAbilityConfirmCancelText(true);
	// Create WaitTargetData
	UAbilityTask_WaitTargetData* WaitTargetData = UAbilityTask_WaitTargetData::WaitTargetData(this, FName("Place WaitTargetData"), EGameplayTargetingConfirmation::UserConfirmed, InTargetClass);
	AGameplayAbilityTargetActor* SpawnedActor;

	//To reiterate, K2Node_LatentGameplayTaskCall only does automagic sorcery for Blueprint.
	// In C++, we have to manually call ReadyForActivation(), BeginSpawningActor(), and FinishSpawningActor().

	WaitTargetData->ReadyForActivation();
	WaitTargetData->BeginSpawningActor(this, InTargetClass, SpawnedActor);
	WaitTargetData->FinishSpawningActor(this, SpawnedActor);

	FGameplayAbilityTargetingLocationInfo TargetingLocationInfo = MakeTargetLocationInfoFromOwnerActor();
	// Set targeting location to the front and ahead of the Player
	TargetingLocationInfo.LiteralTransform.SetLocation(Player->GetActorForwardVector() * 200 + TargetingLocationInfo.LiteralTransform.GetLocation());
	//Assign TargetingLocationInfo to Targe Actor Instance - this is what I was missing
	SpawnedActor->StartLocation = TargetingLocationInfo;

from gasdocumentation.

tranek avatar tranek commented on July 20, 2024

Hello. I wouldn't call the custom channel and profile critical, but that AbilityTask does need a Trace Profile that collides (blocks) with the ground (World Static/Dynamic).

Custom channels and profiles are up to the developers. Most games will make their own channels for things like hitscan bullets and projectiles. Some games might reuse those for abilities or make their own separate ones for abilities. Some games may want their abilities to ignore other abilities in flight or they may want their fireballs to collide with each other. That's more of a general UE4/design thing and less of a GAS thing so I will not include it in the docs as it's very game specific.

from gasdocumentation.

Related Issues (20)

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.