Cannon shot position transform
I'm trying to use a tower in my game and as I build things I compare them to the 3DTD project that I purchased to help with configuration and so on.
In your project, when a tower is instantiated the shotPos Transform is set (to shootPos). I was expecting to see a shootPos transform object somewhere on or under the Cannon model. I can't see it in the inspector, and I can't seem to find one in the components contained under the Cannon. The cannon tower is a bit of a mystery because of the way Prefabs work, but in general I've been making sufficient progress.
How does that shotPos transform field get set? My tower is shooting projectiles from the floor under the tower (when I drag the Cannon to the shotPos TowerBase target). I could add a transform manually, but it wouldn't be from the tip of the cannon, I wouldn't think.
Thanks for any help you can offer.
Baroni last edited by
thanks for registering here!
The cannon tower does have a 'shootPos' game object indeed, did you drag the prefab into your scene to investigate it?
When setting up a new tower, you would create a new transform for the shot position, being a child of the turret (if any), and assign that transform to the 'shotPos' variable in the tower component.
I'm glad that it functions as I thought it might. My FBX import must have lost something along the way. It's not there in my new (separate from the purchased demo) project. The cannon object has no children under it.
I'll back everything up and try it again. Thank you for your reply.
In the event it's helpful to anyone else - I was using the cannon tower .fbx import without the prefab. The tower prefab wasn't even in my project, which nearly worked for what I was trying to do.
Trying to pull little things out of this project for use in isolation can be a challenge, but is usually pretty educational.