x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to rotate my tank turret with my mouse?

Hi all,

I looked lot of tutorial for turret control and applied them all, but no one worked... I tried the last and simpliest way to rotate the turret and the barrel of the turret, but nothing move when I'm moving my mouse.

I think my problem is that my "Axis Z turret BP" variable value can't get to my "Transform (modify) Bone" node, but I don't know why, so if someone know where is my error, please tell me what I did wrong.

In Pawn blueprint "Event graph": alt text

In Pawn animation "Event graph": alt text

In Pawn animation "animation": alt text

PS: Sorry for my bad english

Product Version: UE 4.15
Tags:
screenshot-15.jpg (80.8 kB)
screenshot-17.jpg (73.1 kB)
screenshot-16.jpg (131.1 kB)
more ▼

asked Sep 05 '17 at 09:39 PM in Blueprint Scripting

avatar image

Phantom_Dono
1 2 2

avatar image Arty-McLabin Sep 05 '17 at 10:25 PM

also ensure that "Event Update Animation" is even getting called.

avatar image Arty-McLabin Sep 05 '17 at 10:28 PM

also in the last screenshot, it is possible that your second "Transform (modify) Bone" node overrides the effect of the first one, making only Y variable count. to avoid that, remove one of the nodes, and leave only one, feeding in a rotation which is combination of both Y and Z. (just plug both floats into the same "make rotator").

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

can you ensure the cast to "Mini_Veh_Armor_Car" calls success pin? to check it you can connect printString to fail/success pin to inform you of that.

more ▼

answered Sep 05 '17 at 10:24 PM

avatar image

Arty-McLabin
868 19 41 61

avatar image Phantom_Dono Sep 06 '17 at 03:48 PM

I make the test like you say, and it seem that the cast don't work correctly. You can see on the second picture that sometimes the cast work and sometimes failed. Maybe the the object for the cast is wrong, but I don't know with what I can replace it

alt text alt text

screenshot-19.jpg (106.4 kB)
screenshot-18.jpg (68.8 kB)
avatar image Arty-McLabin Sep 06 '17 at 04:38 PM

take this one step further, and check if the pawn "is valid" before trying to cast it.

avatar image Phantom_Dono Sep 06 '17 at 06:11 PM

I look further but not find how to see if it "is valid so I put string on the pawn value (in dark blue in the picture) and anim value (in red).

So we can see that in the picture: - the 2 value communicate, but the cast sometimes goes wrong - the turret transform don't get the value

So I think that the problem is in the animation, maybe the "transform node" transmit the value only at beginning but don't still modify after...

alt text

screenshot-20.jpg (73.5 kB)
avatar image Arty-McLabin Sep 06 '17 at 06:38 PM

i don't unserstand which values do you mean by red and blue, but anyway, to check if the object is value, just drag it to a node which is called "is valid". every UActor has such function (node).

avatar image Phantom_Dono Sep 06 '17 at 08:02 PM

So, I check if the object is valid, and it is.

The animation "event graph" blueprint : alt text

The animation "animation" blueprint (still be the same than before (Itried to just use one "transform" node, but the result is the same)): alt text

The "event graph" Pawn blueprint :

alt text

I put the rotation of the barrel and the turret to 45°:

Here is the result in edition mode (I get what I want): alt text

But when the simulation is launched, the turret and barrel don't move with mouse movement or still have the 45°: alt text

screenshot-22.jpg (187.9 kB)
screenshot-23.jpg (173.7 kB)
screenshot-26.jpg (99.5 kB)
screenshot-27.jpg (29.3 kB)
screenshot-21.jpg (70.4 kB)
avatar image Arty-McLabin Sep 06 '17 at 08:16 PM

if "is valid" returns false, it means that the object does not exist. you can't do anything with that object therefore. try this. alt text

screenshot-1.png (70.8 kB)
avatar image Phantom_Dono Sep 06 '17 at 08:25 PM

sorry, the last picture is false there is the good one, and it show that the "is valid" return truealt text

screenshot-29.jpg (69.3 kB)
avatar image Arty-McLabin Sep 06 '17 at 08:52 PM

what is the unreal base class of Mini_Veh...? also, what class does the pawn of the AnimGraph belong to?

avatar image Phantom_Dono Sep 06 '17 at 09:07 PM

the base class of base class of Mini_Veh... is a "blueprint pawn wheeledvehicle" and the pawn from the Animgraph belong to the skeletal mesh who is in the "blueprint pawn wheeledvehicle"

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question