The new version of Scratch was launched at the beginning of 2019. Unfortunately I could not find the button which was (in previous versions of Scratch) responsible for positioning things to the center . Of course you can do manually the positioning approximately, but you realize that it is not enough when you have some motions in the code, for example when bouncing back from edges. If anybody has an idea, how can I position new creatures exactly to the center, please share it.
They removed the crosshairs tool in Scratch 3.0. However, the Scratch Team is trying to bring it back.
A way you can get really close to the center is doing the following (in vector mode): make a square around the edge of the canvas. Make the diagonals, and move the sprite where the diagonals meet. This isn't perfect, but is really good and is (probably) the best you can do.
Update:
There is a target tool in the center of the canvas, and that can be used to center, similar to the diagonal lines.
You can't position costumes to the center in Scratch 3.0 anymore. The Scratch Team said they would add it back soon though.
There are dots on the edges of a selected shape, where you can resize it:
o------------0------------o
| |
| |
| |
0 + 0
| |
| |
| |
o------------0------------o
The center ones (marked in 0's) can serve as crosshairs. The little target circle in the center is where the center points should line up with. It is accurate, but may be tedious with a larger shape.
Draw a small circle just above the center mark, move it to a top-level then draw your object and align with the circle. When you finish delete the circle. This is the best I can find so far until the positioning button comes back
As of 2020, the object center is back, so you can use it now!
There is a plus with a circle in the middle of the editor tool and you just need to move the thing to the middle
Related
I'm trying to add a black outline surrounding a sprite I have for a tank.
I've tried following every tutorial I could find on 2d outlines for sprites, however almost all of them were done using a previous unity version (I'm using 2021.1.3f1) and don't seem to have any of the problems I've been having.
After using Alpha subtraction on an offset copy of the sample texture (and multiplying by a color) I then try to add it back to the original sample texture. That's when things go wrong, no matter what I've tried it keeps either chopping off the right side of the sprite (I was trying to add the left outline first), or making the right side of the sprite the opposite color of what I'm putting on the left.
What I mean by "cutting off the right", those treads should be the same thickness on the right as on the left, it's like adding the outline to one side trimmed the other.
If it matters, the sprite is a PNG I got from Kenney and then modified in Krita.
For whatever reason, changing the color of the outline seems to also change how much is getting trimmed.
I've been banging my head against this for four hours now, any ideas or suggestions are greatly appreciated.
Update: After following One Full Time Equivalent's suggestion below I do get an outline surrounding the entire sprite, but now it's distorting the colors at the edges of the sprite as seen here:
After replacing Add with Blend
After your subtraction node, put in an Absolute node, otherwise you will subtract the right edge in the alpha channel (this is exactly what you observe right now). Always be aware that you can only see half the color space and negative channels can be tricky to deal with.
I use the Leaflet plug-in "Leaflet.ImageOverlay.Rotated.js" to use its L.imageOverlay.rotated(...) thing in order to overlay certain map pieces in various places on top of the normal map.
It does this by taking an image and having me tell it its top-left, top-right and bottom-left coordinates to figure out how to rotate, tilt and stretch/squeeze it properly.
It took me a very long time to figure these coordinates out by hand. For this reason, I'm looking for some sort of "geopositioning mode", perhaps enabled by this extension, which would simply let me click three times on the map to tell it where these points go. That would be so simple for the developers to do and would help so much. It's such an obvious thing to do that I strongly suspect it's already implemented and ready.
Is there such a "mode"? If not, how am I expected to find the positions without spending so much time and trial-and-error as I did for the first overlay map image?
Added: I should also clarify that the image should be shown in this mode so that you can re-adjust the points and watch in real time as the image bends/warps, to get it just right.
you can develop a modul for this problem.
find minimum 4 point on raster map.
click on tilemap for 4 points
than find different slope and distance same 2 points.
maybe you must rotate and use affine transformation.
I am new to Unity. Sorry if I have a beginner style of question.
I want to implement a 3D Chess game in Unity. I have already implemented a C++ shared library that contains the whole AI thing. I have used this library in WPF and Android and it is tested perfectly. Now it is Unity's turn.
When the user selects a piece, next moves of it should be shown.
These marks can be a light or image. Circular or rectangle.
One way to do this is to have 64 marks per each square of the Chess board and change their visibility programmatically.
The other way, which I personally prefer, is to draw the marks programmatically. But I don't know how to draw on my Chessboard plane.
Please guide me with it.
FINAL RESULT (Just a sketchup!)
STEP BY STEP:
(I assume you have already had a chessboard)
1. Create a Material & configure it like in the below image. Note that the albedo green is 50% transparent:
2. Create a Quad & assign it the newly created Material above. Then set
it up like in the below image:
3. Now we will add the glow effect. First, we need to turn off the
Anti-Aliasing by switching to Good Quality instead of Fantastic.
4. Second, we need to enable HDR in the main camera:
5. Third, we need to import the Image Effects package. This package
is part of the Standard Assets that is shipped with Unity. It is
completely free. Get it here if you haven't.
https://www.assetstore.unity3d.com/en/#!/content/32351
You only need the Image Effect package.
6. Now add the Bloom effect to your main camera.
7. That's it! If you need to hide it via code then get the reference to
it and execute this line of code:
yourQuad.SetActive(false);
See more here:
https://docs.unity3d.com/ScriptReference/GameObject.SetActive.html
8. Finally, duplicate that quad to create 64 ones & position them
properly. There are 2 tricks that can help your life in hell a lot
easier:
To quickly duplicate a group of objects: select all of them and press: Ctrl + D
To enable edge-snap: select your quad and hold down V then hover your mouse over the quad's vertex. You will see a white square around it. Drag that vetex and see the magic.
9. From this on, it is your game logic to implement. You could store
all the quads in a 2-dimensional array (matrix) and manipulate it
yourself, that it all I can think of. Goodluck!
I want to have a playing area with a square dimension, and a sidebar GUI that can be resized according to the resolution. I drew a picture that might help explain
I tried following a tutorial here but the actual dimensions in the build I run seem to be different from what I configure it to in my editor. Also, how do I get the coordinates of the middle of the square (to instantiate something)? Any help? Thanks!
In the tutorial you linked it says:
When running your game from within Unity's editor, be sure to have the Game >window open and visible in the editor when you run the game. There's >currently a bug in Unity 3.0 (and possibly in earlier versions as well) where >the window resolution reported to the script does not match the actual >resolution of the window inside the editor if the window isn't visible at the >time the play button is pressed, leading to a viewport with the wrong size.
Did you took notice to this?
Also what do you mean by taking the coordinates in the center of the square? If you mean the actual screen, then you should get a point based on the square dimensions like:
Vector2 point;
Rect rect = camera.rect;
point.x = rect.x/2;
point.y = rect.y/2;
But if you want the point in 3D space where the camera is pointing, you can use the default method ViewportToWorldPoint, as shown here: http://answers.unity3d.com/questions/189731/how-would-i-find-a-point-in-front-of-my-cam.html
It should look like this:
float distanceFromViewPort = 1 //change 1 to the distance you wish the instance to appear away from the camera.
Vector3 point = camera.ViewportToWorldPoint(Vector(0.5,0.5,distanceFromCamera));
I'm developing a game in which I've imageviews for bow and arrow. I actually wanted to move this arrow along a circular path when set in the air. Specifically, this circular path should be the one which an object will travel when thrown in the air at a distance i.e. it'll move upwards first and then downwards.
I've already tried using CAKeyFrameAnimation but the curved path drawn was actually down first and then up, objects don't usually travel that way.
I have already seen other articles related to this on Stack Overflow and nothing seemed suiting my requirements. I hope I didn't miss anything.
I've already tried using CAKeyFrameAnimation but the curved path drawn was actually down first and then up, objects dont usually travel that way
Sounds like all you need to do is change your math for the y axis. Do your current math but multiply the y axis delta by -1.