private void OnFirePressed() { var character = GetCharacter(); var result = new FHitResult(); GetWorld().DebugDrawTraceTag = "drag&drop"; GetWorld().LineTraceSingleByChannel( result, character.GetCapsuleComponent().GetWorldLocation(), character.GetCapsuleComponent().GetWorldLocation() + GetControlRotation().Vector() * DragDropDistance, ECollisionChannel.ECC_Visibility, new FCollisionQueryParams(GetWorld().DebugDrawTraceTag, true, null), new FCollisionResponseParams(ECollisionResponse.ECR_Block) ); _pickUpObject = result.GetActor(); _dragDistance = result.Distance; if (_pickUpObject?.IsRootComponentMovable() == false) { _pickUpObject = null; } Ue.ScreenDebugMessage(result.GetActor()?.GetName()); }
/// <summary> /// Set the rotation of the component relative to its parent and force RelativeRotation to be equal to new rotation. /// This allows us to set and save Rotators with angles out side the normalized range, Note that doing so may break the /// RotatorCache so use with care. /// </summary> /// <param name="newRotation"></param> /// <param name="hitResult">Hit result from any impact if sweep is true.</param> /// <param name="sweep">Whether we sweep to the destination (currently not supported for rotation).</param> /// <param name="teleport">Whether we teleport the physics state (if physics collision is enabled for this object). /// If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). /// If false, physics velocity is updated based on the change in position (affecting ragdoll parts).</param> public unsafe void SetRelativeRotationExact(FRotator newRotation, out FHitResult hitResult, bool sweep = false, ETeleportType teleport = ETeleportType.None) { byte *buff = stackalloc byte[StructDefault <FHitResult> .Size]; Native_USceneComponent.SetRelativeRotationExactHR(this.Address, ref newRotation, sweep, (IntPtr)buff, (int)teleport); hitResult = new FHitResult((IntPtr)buff); }
public unsafe bool MoveComponent(FVector delta, FRotator newRotation, bool sweep, out FHitResult hit, EMoveComponentFlags moveFlags = EMoveComponentFlags.NoFlags, ETeleportType teleport = ETeleportType.None) { byte *buff = stackalloc byte[StructDefault <FHitResult> .Size]; bool result = Native_USceneComponent.MoveComponentRot(this.Address, ref delta, ref newRotation, sweep, (IntPtr)buff, (int)moveFlags, (int)teleport); hit = new FHitResult((IntPtr)buff); return(result); }
public void HitResultTest(byte[] rawData, int bitCount, string boneName) { var reader = new NetBitReader(rawData, bitCount); var hitResult = new FHitResult(); hitResult.Serialize(reader); Assert.True(reader.AtEnd()); Assert.False(reader.IsError); Assert.Equal(boneName, hitResult.BoneName); }
private void OnFire() { var character = GetCharacter(); var result = new FHitResult(); GetWorld().DebugDrawTraceTag = "test"; GetWorld().LineTraceSingleByChannel( result, character.GetCapsuleComponent().GetWorldLocation(), character.GetCapsuleComponent().GetWorldLocation() + GetControlRotation().Vector() * 800, ECollisionChannel.ECC_Visibility, new FCollisionQueryParams("test", true, null), new FCollisionResponseParams(ECollisionResponse.ECR_Block) ); Ue.ScreenDebugMessage(result.GetActor()?.GetName(), 20); Ue.ScreenDebugMessage(character.GetCapsuleComponent().GetWorldLocation().ToString(), 5, System.Drawing.Color.Red); }
private void BoxOnOnComponentBeginOverlap(UPrimitiveComponent overComp, AActor otherActor, UPrimitiveComponent otherComp, int otherbodyindex, bool bfromsweep, FHitResult sweepresult) { Ue.ScreenDebugMessage($"BeginOverlap {otherActor} don't overlap {overComp} now"); }
protected void ReceiveHitWrapper(UPrimitiveComponent MyComp, AActor Other, UPrimitiveComponent OtherComp, bool SelfMoved, FVector HitLocation, FVector HitNormal, FVector NormalImpulse, FHitResult Hit) { if (Other != null && Other.ActorHasTag(gamemode.BallTag)) { if (bHitFirstPin.Get(this) == false) { bHitFirstPin.Set(this, true); if (MyAudioSourceComponent == null) { MyOwner.PrintString("Please Assign an audio component to the uproperty", FLinearColor.OrangeRed); } else if (PinStrikeSoundVolume1 == null) { MyOwner.PrintString("Please Assign a sound clip to the PinStrikeSoundVolume1 sound uproperty", FLinearColor.OrangeRed); } else if (PinStrikeSoundVolume2 == null) { MyOwner.PrintString("Please Assign a sound clip to the PinStrikeSoundVolume2 sound uproperty", FLinearColor.OrangeRed); } else if (PinStrikeSoundVolume3 == null) { MyOwner.PrintString("Please Assign a sound clip to the PinStrikeSoundVolume3 sound uproperty", FLinearColor.OrangeRed); } else if (PinStrikeSoundVolume4 == null) { MyOwner.PrintString("Please Assign a sound clip to the PinStrikeSoundVolume4 sound uproperty", FLinearColor.OrangeRed); } else if (PinStrikeSoundVolume5 == null) { MyOwner.PrintString("Please Assign a sound clip to the PinStrikeSoundVolume5 sound uproperty", FLinearColor.OrangeRed); } else { PlayPinStrikeSounds(Other); } } } }
private void Collider_OnComponentBeginOverlap(UPrimitiveComponent overlappedComponent, AActor otherActor, UPrimitiveComponent otherComp, int otherBodyIndex, bool bFromSweep, FHitResult sweepResult) { _bodyCount++; }
public void OnBeginOverlapWrapper(UPrimitiveComponent OverlappedComp, AActor OtherActor, UPrimitiveComponent OtherComp, int OtherBodyIndex, bool bFromSweep, FHitResult SweepResult) { if (OtherActor != null) { if (OtherActor.ActorHasTag(gamemode.BallTag) && gamemaster.bBowlTurnIsOver == false) { var _ballComp = OtherActor.GetComponentByClass <UBowlingBallComponent>(); if (_ballComp != null) { _ballComp.StopRollingSound(); } StartCoroutine(WaitForPinsToFall()); } else if (OtherActor.ActorHasTag(gamemode.PinTag)) { OtherActor.DestroyActor(); } } }