AttachTo() disables movement of the car
Hi everybody, I hope you could help me out with this, I'm new to the Unreal Engine.
I'm working with the Vehicle template project that comes UE 4 (not the advanced one, and using C++ not Blueprint). I have to work in code only, due to what my supervisor tells me, so no BP. I want to add a collision box to the front of the car that extends 1000 units forward in order to "scan" the area in front of the car for objects it can collide with. Later I intend to measure the distance between the car and the different objects infront of it. I have added the following code att the end of the constructor ASimpleCarPawn::ASimpleCarPawn()
The problem is that now the car doesn't move any more, the gear is shifting though, so the code seems to be working, except that the car is not moving. If I however remove the last line CollisionScan->AttachTo(GetMesh()); the car can run as it should, however now the collision box i fixed in the world and does not follow the car around and also its position is not correct in relation to the car, as if the SetRelativeLocation is now using the world as a base point rather then the car itself. To clearify, when i do have the CollisionScan->AttachTo(GetMesh()); code in there, the position of the collision box in relation to the car is correct, but as I said, now the car does not move.
What am I doing wrong? How can I fix this? Thanks for your time! /Kristoffer
Try to get a look at the CollisionScan's mesh properties: maybe it's set to blockAll, thus blocking the movements and/or keeping the car slightly up in the air.
answered Jun 18 '15 at 02:37 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here