# Line Trace, Mouse Cursor, and Replication

**URL:** <https://forums.unrealengine.com/t/line-trace-mouse-cursor-and-replication/300165>\
**Category:** Blueprint\
**Tags:** line-trace, Replication, mouse-cursor, unreal-engine, Blueprint, question\
**Created:** [November 30, 2014, 1:02am UTC](https://forums.unrealengine.com/t/line-trace-mouse-cursor-and-replication/300165 "2014-11-30T01:02:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_618bb797](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_618bb797](https://forums.unrealengine.com/u/anonymous_user_618bb797)\
**Post date:** [November 30, 2014, 1:02am UTC](https://forums.unrealengine.com/t/line-trace-mouse-cursor-and-replication/300165/1 "2014-11-30T01:02:55Z")

</div>

I am trying to make it so that when the player casts a hit-scan/mouse over spell, the spell spawns an emitter that attaches to the casting player and to the location hit by the hit scan.

In the character native class:

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/5/b/f5ba5455dad6c09402f702623ec6f1e725cbf368.png)  
In the case of hit-scan/mouse-over spell, it performs the following in C++:

![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/6/1/f61291964c657aba7e5a96a789a3c7a84e8f01bf.png)  
HitScanTest is a BlueprintNativeEvent

![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/4/3/243b41d86af3f776515968419cb8dba4b9188599.png)

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/3/0/b30d845800b9379b4a875bf89dcd1af455efd18c.png)  
 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/4/5/845e45a80569fa2ce022923f78e3f080b167813e.png)  
Now, I’m running into a few bugs.

1.) The CurrentMousePick HitResult’s Location is always 0,0,0 for anybody with a Role less than AUTHORITY.

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/d/8/7d8e5da501b74953c7a26c6f8cadc918e2605f12.jpeg)  
 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/9/1/c9162f0d6d5fd987f88f2f99b8e1261a437e5b14.jpeg)  
2.) Sometimes the CurrentMousePick doesn’t update. I’ll cast the previously pictured lightning bolt spell on one spot, move the mouse, cast it again, and it sometimes targets the previous location.

3.) Now, I wish to replicate this event for client events. Currently, when the authority casts the lightning bolt, it properly replicates. When the client casts the spell, it replicates the 0,0,0 targeted emitter mentioned in #1.

Any help is appreciated. Thanks.

---

<div class="post-metadata">

**Author:** ![eXi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/exi/32/906583_2.png) [@eXi](https://forums.unrealengine.com/u/eXi)\
**Post date:** [November 30, 2014, 8:51am UTC](https://forums.unrealengine.com/t/line-trace-mouse-cursor-and-replication/300165/2 "2014-11-30T08:51:45Z")

</div>

Hey,

just a test:

Try putting a second custom event between these two:

[http://i.imgur.com/0ZUO2vE.png?1](http://i.imgur.com/0ZUO2vE.png?1)

Make it “Run on Server”. Use an Athority Switch, if possible, and plugin the “Event hit Scan Test” into it. Take the Remote exec and plug it into the new event. Now plug in the “Authority” exec into your existing node and also the Red Node from your new Event into it. So that the server (authority) directly calls your SpawnAttack function and the client first tells the server to call it.

---

<div class="post-metadata">

**Author:** ![codehawk64](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@codehawk64](https://forums.unrealengine.com/u/codehawk64)\
**Post date:** [September 13, 2015, 8:43am UTC](https://forums.unrealengine.com/t/line-trace-mouse-cursor-and-replication/300165/3 "2015-09-13T08:43:05Z")

</div>

Did you get this to work ? im currently facing this issue where the mouse data doesnt get updated to other clients .

---

<div class="post-metadata">

**Author:** ![lukaoooo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@lukaoooo](https://forums.unrealengine.com/u/lukaoooo)\
**Post date:** [May 31, 2022, 3:20am UTC](https://forums.unrealengine.com/t/line-trace-mouse-cursor-and-replication/300165/4 "2022-05-31T03:20:20Z")

</div>

I solved my problem

> [@Mouse Cursor Replication](https://forums.unrealengine.com/t/mouse-cursor-replication/431228):
>
> This is my second post about this, and it seems that nobody knows how to fix it i read about this on almost every internet page and still can’t find any possible solution i was hoping that AnswerHub will get my problem solved but unfortunatly not. my problem is to replicate mouse location between client and server. Server : i click to move character move well / perfect ! client see everything character move to the exact same location where server cursor is. Client : click to move NPC didn’t r…

or as I did in my project

in Player controller

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/d/f/edfbf01a0f17141b60685a82593604549d417b8a.png)

in Player Character

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/2/c/92cd644842f274dd1ca028b7c60ad4cfe8cb5ffd.png)
