playMaker

Author Topic: [SOLVED] Creating an object that fills a gap between 2 points using playmaker.  (Read 3213 times)

upOwlNight

  • Playmaker Newbie
  • *
  • Posts: 27
Example: I want to shoot a Laser from my soul stealing gun to dead body. soul gun is point A, body is point B.

Ideally I'd like to have an object, say a capsule, with a fixed radius scale from my gun to the body.

I know how to use raycast to get the B location, and how to spawn it from the gun for my A location, I just cant figure out how to fill the gap with the laser beam.

Thoughts and ideas are welcome, keep in mind I'm looking to solve this using just playmaker
« Last Edit: August 21, 2013, 04:18:15 PM by upOwlNight »

upOwlNight

  • Playmaker Newbie
  • *
  • Posts: 27
here, a quickfix update for anyone else looking for this answer. This is a temporary solution that I may keep and enhance if I cant find another solution:

  • I used raycast to store a vector3 with the collider it hits.
  • I stored the vector3 into a variable called ray_hit
  • Created a game object (simple cube in this case) at position: ray_hit
  • Store that game object in the create object settings under ray_spawn_point
  • Used "Look At" to have ray_spawn_point look at taget object (gun)
  • Used a second "create game object" to create a particle system (made into a prefab) called "gun particles"
[li]
[/li][/list]
When I press the mouse button now a stream of particles jets from a dead body to my soul gun

upOwlNight

  • Playmaker Newbie
  • *
  • Posts: 27
I'm still stuck here guys. My temporary fix was kind of cool, but not what I need :(. I wont bump anymore.

to re-iterate, I just need to create a new object with dimensions to be the length of a my raycast, and width of my choice.. hmm this way of explaining gives me some ideas.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
have you tried to create an object with z scale of 1, look at the target on z, then set the z scale to the distance returned? (pivot will have to be right on the bottom of the object so it doesnt scale backwards)

You can just use the distance and put it directly as the scale as long as the starting object is a size of 1. Try a cube. Then you just need it to look at the target.

I guess you're trying to make particles float toward the gun? Not sure what the application is. Why use a cube?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

upOwlNight

  • Playmaker Newbie
  • *
  • Posts: 27
ah, a response! thank you! so I created an object in a 3d application, and set the anchor point to one end of it. My raycast returns a hit distance of 180. If I apply that distance to my scale it doesn't scale the object up nearly enough. Im thinking the distance and scale aren't related. Did I miss something?

Scratch the particle idea, the cube was just a spawn point. Created a cube (or empty game object) spawn from it. Kinda clunky, but nevermind the particles.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
It should work if the cube you create fills 1 unit on that axis, so at scale 1 it is 1 unit long.

With the pivot at the bottom if that scale is changed to 200 then it should make it 200 units long (200 units * 1, the 1 being original size it occupied.) but the original object must be 1 unit long. You can adjust the multiplier math if you have an object is of a different size, using 1 just makes it simpler.

There's probably a better way to do it, but it should work this way if you just want a cube spanning between two points.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

upOwlNight

  • Playmaker Newbie
  • *
  • Posts: 27
Holy crap! So simple! I know that's going to work, thank you so much. I just didnt have it scaled right I bet, the 1:1 ratio. What was I thinking. Thanks again!