I try to teleport my player character while he dropping from the map I teleport him to the origin position.
my issue is my character can’t be teleport back to the original location while him in the air,and I can use any way to set the playercharacter’s location.
Using this setup, when I press F, my character is teleported back to 0, 100, 0, which is the center of the platform, and 100 units up just to ensure I don’t end up stuck in the floor.
I assuming I used same node ur did.(A Press event node and teleport node).my problem is I can teleport to the exact location while I walking on the ground.but when I drop down from the ground in air after 1s I can’t be teleported back to location on the ground.
Could you please provide screenshots of the blueprint that you are using to teleport your character? I’d like to see how you are setting it up. Thank you.
Have a look at this documentation for Networking with the Character Movement Component Character Movement Component | Unreal Engine Documentation
As you will see, there are different measures that need to be taken in account with the Character Movement Component when using it in a multiplayer game.
I followed the "Approach 4: CharacterMovementComponent Ability Implementation " which is you gave me tutorial but still not work.May I have a example about how to fix it?
I still try others’ way to fix it like following picture.
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/CharacterMovementComponent.h"
#include "SCharacterMovementComponent.generated.h"
UCLASS()
class MYPROJECT_API USCharacterMovementComponent : public UCharacterMovementComponent
{
GENERATED_BODY()
/** Unpack compressed flags from a saved move and set state accordingly. See FSavedMove_Character. */
virtual void UpdateFromCompressedFlags(uint8 Flags) override;
};
/** Shared pointer for easy memory management of FSavedMove_Character, for accumulating and replaying network moves. */
typedef TSharedPtr<class FSSavedMove_Character> FSSavedMovePtr;
class FSNetworkPredictionData_Client_Character : public FNetworkPredictionData_Client_Character
{
virtual FSavedMovePtr AllocateNewMove() override;
};
/** FSavedMove_Character represents a saved move on the client that has been sent to the server and might need to be played back. */
class MYPROJECT_API FSSavedMove_Character:public FSavedMove_Character
{
public:
uint32 bPressedTeleport : 1;
enum CompressedFlags
{
FLAG_JumpPressed = 0x01, // Jump pressed
FLAG_TeleportPressed = 0x03, // Teleport pressed
FLAG_WantsToCrouch = 0x02, // Wants to crouch
FLAG_Reserved_1 = 0x04, // Reserved for future use
FLAG_Reserved_2 = 0x08, // Reserved for future use
// Remaining bit masks are available for custom flags.
FLAG_Custom_0 = 0x10,
FLAG_Custom_1 = 0x20,
FLAG_Custom_2 = 0x40,
FLAG_Custom_3 = 0x80,
};
/** @returns a byte containing encoded special movement information (jumping, crouching, etc.) */
virtual uint8 GetCompressedFlags() const;
};
I apologize for the delay, I was looking into this issue.
What you’ll need to do is setup your teleport mechanics on the server side instead of in the client. However, the teleport function itself has issues when it comes to replication, so consider using set actor location instead and seeing if that makes a difference in your setup.