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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to snap a spawned actor to existing actor?

Edit 17-01-2016 15:49 GMT

I can attach actor to socket when spawning, but is there a way to get socket name thats closest to my character or better to other item?

When i look at actor, it checks for hit, and when present it spawns another actor on top (i only have one socket). Is there a way to get a reading of actors side or plane or something so i can spawn to relative socket on that plane.

/ Edit 17-01-2016 15:49 GMT

Hi Could You guys point me in the right direction for building a base from predefined actors. I'd like to put a "magnetic" points on actor, so when i spawn an actor from my inventory it automatically snaps in the right position. Like joining walls together, basically building system from fallout 4.

I tried putting target points on the ground but thats not working out for me. Maybe if there was a way to put target point onto actor then i could figure something out.

I also tried to put colision boxes onto mesh, but when i spawned an actor next to it it didnt register. Ive read something about pivot points, but im not that fmailiar with 3d modeling. Is there a way to add additional pivot point into actor, and if so how i should activate them to join?

Right now im spawning actors by running loop, its basically spawning and destroying actor, and it allows me to move and adjust position. when im happy with it i press LMB and actor is spawned indefinitally. I dont know if thats the best way though.

All answers appreciated. Thanks.

ps i just thought about a way to do it, does i make sense when in building mode to change movement and camera rotation to predefined values, like turn every 45 degres, move every 20 spaces, this way it should be easier to snap

or mathematically round up or down spawned actor world location? I dont want to do it worng way, and later have to add pivots or anything else to my models.

Product Version: UE 4.10
Tags:
more ▼

asked Jan 17 '16 at 11:45 AM in Blueprint Scripting

avatar image

TomaszuJerzy
1 2 3 4

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

2 answers: sort voted first

Hi man , its really not clear what you need , so here some thing that you can do.

You can spawn any actor in any place in the universe. If you want to spawn at the center of the CharacterB you can get his location and spawn there.

The Character, and a lot of things have a center. The center may be not where you want to spawn. So you have to add a handmade vector using the relative vectors like Forward and Up . to make a vector to add to your spawn to put "the hat on his head".

Unreal have a sistem of sockets. You can for example, get the mesh of a character and add a socket to a bone. So when you want to spawn the object in his hand... you can get the mesh reference, and search for his HAND-SOCKET... Get his transform to place the spawn exactly there.

Sure you need to attach the spawned actor to the socket or the actor or anything that moves.

You can also have around in the world some Actors or target that you can use to address your spawn. Lets say you want to add a point light in the nearest lamp. You can search for all actor lamp, check and store the nearest one with a loop , and then use the lamp location to spawn there a pointlight.

Sure you can use also an array to store the same informations.

In the editor you can move and snap the Actors and the meshes using the grid sistem, or the XYZ location in the details, or also snapping to the vertex, pressing and moving with the middlemouse.

Try to search for some info about these stuff....

more ▼

answered Jan 17 '16 at 12:28 PM

avatar image

Est_engine
1.2k 58 12 62

avatar image TomaszuJerzy Jan 17 '16 at 12:42 PM

Thanks for answer

Sorry its a little haotic post, ill try to explain further.

Spawning take place in a game, i have no problems using grid in editor.

Im spawnign a wall on the ground, with line trace from my camera and with vector extended so it spawn roughly 3 meters from my character.

What i want to do is when i select my next actor to spawn, it will snap to existing wall on the ground, either side to side (maiking it 2 times longer) or with rotation (making a building corner), depending on how i look at it.

I can already spawn another wall, and move it roughly in position, but theres always something off, like height or space between them. That wouldnt be that bad, except im worrying its going to mess my textures later.

Im familiar with attaching items to socket on a skeleton, like for example putting weapon into hand, or a hat on a head. But i didnt know i can put it on static actors. Im going to research that topic. Thanks for your help.

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

Hey, I found this solution for my self. This tool is comfortable to work. Look at Vertex Snapping! Learn more here https://docs.unrealengine.com/latest/INT/Engine/Actors/Transform/

Hope this helps.

more ▼

answered Dec 15 '16 at 06:53 PM

avatar image

afg4x4
1 1 1

(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