Parenting to the player
Quote from gallardo on June 8, 2013, 1:18 pmHi there,
I have a func_brush attached to the player (parent, !player) and then a entity_maker attached to the brush (inherit dir is on).
Problem is that when I spawn an item, the direction is not always correct, especially when I turn not so fast and the aim stays off a bit.What's I'm doing wrong?
Thanks
Hi there,
I have a func_brush attached to the player (parent, !player) and then a entity_maker attached to the brush (inherit dir is on).
Problem is that when I spawn an item, the direction is not always correct, especially when I turn not so fast and the aim stays off a bit.
What's I'm doing wrong?
Thanks

Quote from ChickenMobile on June 9, 2013, 2:56 amIs there any delay with spawning the item?
Technically any process is going to take more than 'immediately'.
Is there any delay with spawning the item?
Technically any process is going to take more than 'immediately'.
Quote from gallardo on June 9, 2013, 5:48 amSure, but it's not the case, since if you stop turning, the aim can remain off a bit anyway, then if you make a step forward or backward (no change of dir), it gets right.
Sure, but it's not the case, since if you stop turning, the aim can remain off a bit anyway, then if you make a step forward or backward (no change of dir), it gets right.
Quote from FelixGriffin on June 9, 2013, 10:21 amIf the player rotates without moving forwards, only the view changes. SetParentAttachmentMaintainOffset to eyes and it should be good, although if you don't want it to move up and down forward might be a better attachment point. I ran into this when I was building the shield from Bastion.
If the player rotates without moving forwards, only the view changes. SetParentAttachmentMaintainOffset to eyes and it should be good, although if you don't want it to move up and down forward might be a better attachment point. I ran into this when I was building the shield from Bastion.
Quote from gallardo on June 9, 2013, 10:55 amYes, I need it just to rotate on 1 axis, so if the player raises the view the item is still spawned parallel to the ground.
I'll try what you suggested and report asap, thanks!
Yes, I need it just to rotate on 1 axis, so if the player raises the view the item is still spawned parallel to the ground.
I'll try what you suggested and report asap, thanks!
Quote from gallardo on June 9, 2013, 11:40 amI've tried a bit but it doesn't seem to work.
SetParentAttachmentMaintainOffset to weapon_att should have been fine, but again it parents to the gun in thirdperson, not the one visible in firstperson
Looking at it in thirdperson I can see the parented brush turn perfectly (entity_maker is parented at it), but not the player model. I wonder how the brush is visually in line, but not the entity_maker...
I've tried a bit but it doesn't seem to work.
SetParentAttachmentMaintainOffset to weapon_att should have been fine, but again it parents to the gun in thirdperson, not the one visible in firstperson
Looking at it in thirdperson I can see the parented brush turn perfectly (entity_maker is parented at it), but not the player model. I wonder how the brush is visually in line, but not the entity_maker...

Quote from josepezdj on June 11, 2013, 5:04 amI'm not sure if what you need is to parent something to the gun or to the player... However, bare in mind that it's not that easy to parent something to the portalgun when the player already holds it; from this moment on, the portalgun becomes a 'viewmodel' and not a 'world model' anymore (and it's difficult to find its attachment points... at least for me, without scripting)... You can parent whatever to the portalgun before the player picks it up though and it will be still there parented after the player picked the gun up. I think this could be the better approach than the player 'eyes' attachment in order to avoid possible sudden player moves and such in the meantime before the parenting takes place.
As Felix said, I think that SetParentAttachmentMaintainOffset would be the best way to go... Why are you parenting a func_brush inbetween, before the entity maker? is it in order to give a proper orientation to the future spawned entity? ...Anyways, just: name the portalgun (you can disable its motion), name the func_brush and the entity maker, place the func_brush and entity maker at the distance you need to from the gun muzzle, add the portalgun name to the func_brush parent property, the func_brush name to the entity maker's Parent property, and then fire the outputs via a logic_auto:
- OnMapSpawn > [func_brush_name] > SetParent > [portalgun's name] / delay 0.10
- OnMapSpawn > [func_brush_name] > SetParentAttachmentMaintainOffset > [portalgun's name] / delay 0.10
- OnMapSpawn > [maker's name] > SetParent > [func_brush_name] / delay 0.20
- OnMapSpawn > [maker's name] > SetParentAttachmentMaintainOffset > [func_brush_name] / delay 0.20It should work...
After that, you can teleport the gun to the player by using the target !player
I'm not sure if what you need is to parent something to the gun or to the player... However, bare in mind that it's not that easy to parent something to the portalgun when the player already holds it; from this moment on, the portalgun becomes a 'viewmodel' and not a 'world model' anymore (and it's difficult to find its attachment points... at least for me, without scripting)... You can parent whatever to the portalgun before the player picks it up though and it will be still there parented after the player picked the gun up. I think this could be the better approach than the player 'eyes' attachment in order to avoid possible sudden player moves and such in the meantime before the parenting takes place.
As Felix said, I think that SetParentAttachmentMaintainOffset would be the best way to go... Why are you parenting a func_brush inbetween, before the entity maker? is it in order to give a proper orientation to the future spawned entity? ...Anyways, just: name the portalgun (you can disable its motion), name the func_brush and the entity maker, place the func_brush and entity maker at the distance you need to from the gun muzzle, add the portalgun name to the func_brush parent property, the func_brush name to the entity maker's Parent property, and then fire the outputs via a logic_auto:
- OnMapSpawn > [func_brush_name] > SetParent > [portalgun's name] / delay 0.10
- OnMapSpawn > [func_brush_name] > SetParentAttachmentMaintainOffset > [portalgun's name] / delay 0.10
- OnMapSpawn > [maker's name] > SetParent > [func_brush_name] / delay 0.20
- OnMapSpawn > [maker's name] > SetParentAttachmentMaintainOffset > [func_brush_name] / delay 0.20
It should work...
After that, you can teleport the gun to the player by using the target !player
Quote from CamBen on June 11, 2013, 12:18 pmSo then the func_brush will follow the movement of the portal gun?this could be useful to me as well.
So then the func_brush will follow the movement of the portal gun?this could be useful to me as well.
Aperture Science: We do our science asbestos we can!
Quote from KathyGraham on June 12, 2013, 5:30 amThat's the best way for doing this, I have done this.
That's the best way for doing this, I have done this.