First of all, I'm sorry about not inlining images because of lacking reputation.
I have 2 problems with Aframe-extras by DonMcCurdy and I've read many documents but could not find the solution.
FYI, I've set kinematic-body for my camera.
Problem 1:
I can not go inside my static-body circular table:
My circular table:
The table was made with Blender and was exported to Collada model.
I know that aframe-extras will consider my circular as a box (bounding box of the model) and it prevent me to move through that box. That's why I cannot come inside my circular table.
So that I'm going to use the solution 2,
I remove the static-body from my circular table, then create a static-body "line" around the circular table myself.
But I met the problem 2 below:
Problem 2:
The static-body bar (It's the red one in below image) prevent me to move closer to it, the minimum distance from me to the red bar ~1.5 unit * (1 unit = 1 meter in my case)*.
My expectation distance is 20cm.
So the final question is:
How can I move closer to it?
You can see my screenshot here:
for more detail.
The last time I looked the default radius to the kinematic-body was 1.3, that looks like it's too wide for your scene. Try setting the radius to 0.5.
kinematic-body="radius:0.5"
If that doesn't work, you may also need to check the static body and set the shape to hull.
static-body="shape:hull"
For anyone who met the same problem, my solution is:
As #manny-meadows suggest: Set radius to 0.5 (0.2 = 20cm is too small)
kinematic-body="radius:0.5"
Then you still go through the red bar, like this video: photos.app.goo.gl/tukxoyV2dtVPkNUX2
So need to do an extra thing, increase your bar height:
From:
< a-box static-body="shape: box;" color="tomato" depth="0.1" height="1" width="20" position="0 0 -4" material="transparent: true; opacity: 0.9"/>`
To:
< a-box static-body="shape: box;" color="tomato" depth="0.1" height="2" width="20" position="0 0 -4" material="transparent: true; opacity: 0.9"/>
Everything work.
Related
I want to make the ground in this place of the terrain a bit deeper a bit lower but left shift key or right shift key and the left mouse button does not change anything on the terrain.
I've been looking for an answer for hours, and I finally found it.
If you are trying to lower a piece of land that is already at 0 height, you will not be able.
You can only lower areas that are above to height 0. In short, height 0 is the minimum: you cannot go to snow values due to the way the terrain is created.
To be able to make valleys then you have to select the tool "Set Height", enter a height and raise all the ground to that height with "Flatten All", or small pieces of land by dragging the mouse on the ground.
If you click "Flatten All", all the terrain will be brought to that height, losing all the changes made previously for the mountains.
However, if you have already made land and you don't want to lose it and redo it from scratch, you can use the following solution:
Export the current heightmap;
Open the image in an editor; (I'm not an expert in Photoshop or other
graphics programs, but I'm sure Photoshop has a way. If there isn't
an entry in the program, find out how to use scripts in photoshop)
Find a way to set the pixels according to a formula: maximum depth of
valleys + current value of the grayscale pixel * original height /
(original height + maximum depth of valleys);
Export the image in Raw format;
Go back to Unity and import it on the ground as you read in the link
above;
In the terrain settings set the height equal to the value you used
in the formula called "original height" + the “maximum depth of
valleys” value;
You should now have the ground as before, but higher. Set the value
in the transform of the Y position equal to "-maximum depth of
valleys" so that it is at the same height as before.
You should now be able to create valleys!
I haven't tried the process, but I've thought about it so much I'm pretty sure it will work.
Good work!
I have an image (represented as green) overlaying a box (represented as blue), and the image is going to be transform: scale()ing in size. When this happens I need all edges of the image to complete their transformation at the same time.
To do this I need to calculate the transform-origin based on where the image is located overtop of the bounding box, using JavaScript. Assume I know all the coordinates that getBoundingClientRect() provides, for both elements.
In the six examples below I’ve placed a red dot where the transform-origin percentages should intersect.
I just can’t figure out the math to get there. The closest I've come to finding an answer is with this question, but it's a little vague and I'm not sure I fully understand the answer itself. I would greatly appreciate help with this, and will happily provide more details if I'm missing something.
After fiddling around, I figured out the formula is:
(
(box.left - image.left) /
(image.width - box.width)
) * 100
I'm working on something that relies on the fill amount of the image.
However, the fill amount may be weighted slightly? I'm unsure. Here is my evidence:
This is the amount set to 0.2
However, setting it to 0.1 shows
I would have thought that 0.1 would have shown half of 0.2. Does unity therefore actually measure fill amount from 0.1 -> 1, instead of 0 -> 1 as the documentation suggests, or am I just being stupid?
Think I know the answer to this one.
I am assuming your image may not be clipped to the edge, and you have a transparent boarder? Also ensure the image is a power of 2 when you import it, as forcing a power of 2 in the texture import settings could also introduce a boarder.
Having a board would mislead you into thinking nothing it showing up until 0.1, when infact it is showing the transparent boarder.
I have a 3D bar chart. Let me clarify, I do not want to edit the width of the bar graph as I have already done that. However, there are black lines that outline each bar. Is there a way to make these thicker?
Everything I have search pays reference to the width of the bars themselves, not the black lines enclosing them.
At last, I found the answer to my own question the minute after I ask it.
Simply:
set(j,'LineWidth',1.5)
EDIT: As Luis mentioned, j is the handle such that j = bar3(...)
Sorry should have included that.
I want to create a vertical bar plot. This is my code:
bar (x, sensiv);
title ('Promedio X')
xlabel('Nm')
ylabel('Refl.')
The problem is it looks like a stair plot. I've tried to add (x,sensiv, 'stacked') but it doesn't work. It looks grouped, as you can see in the next image:
graph http://imageshack.us/a/img689/9449/capturawv.jpg
I think it's because of x-axis but I couldn't change it. How can I do it? Does somebody knows how can I do it?
EDIT
Thanks Colin! I've tried to zoom and I understand what you mean and I've tried with different values, as slayton and you said.
I think that maybe it's the way I've code the plot, it is possible?
abc=0;
for p=(61:201)
abc(p)=out1_c;
end
for p=(151:301)
abc(p)=out2_c;
end
for p=(231:380)
abc(p)=out3_c;
end
for p=(381:596)
abc(p)=out4_c;
end
for p=(1152:1531)
abc(p)=out5_c;
end
for p=(1651:2051)
abc(p)=out7_c;
end
for p=(2052:2151)
abc(p)= 0;
end
The default value for the width of the bars in a bar plot is 0.8, so given that you're not currently specifying the width, you should have gaps in between each bar. This is going to sound really obvious, but have you tried zooming in on the bar plot that is created? For some datasets, the bar function will return a plot that looks like a stair plot, but in fact has gaps if you zoom in far enough. If this is the case, then you should be able to get the gaps you want by tinkering with the width parameter as suggested by slayton.
EDIT
Okay. First things first. If you want to post additional information, you should add it to your question, NOT post it as a new answer! You can do this by clicking the edit button just below where your question is on the page. To make things more readable, you might preface your edit with a capitalized bold-face heading "EDIT" as I have done here. If you are able, try now to move the additional information you've given back into your question, and then delete the answer.
Second, I have to be honest, the additional information you posted was somewhat confusing. However, I think I understand what you want now. You want 7 bars coming up to the heights out1_c, out2_c, ..., out7_c (variable names taken from your additional information) with a small gap between each bar, and the x-axis to reflect (approximately) the intervals 450-550, 550-650, etc.
Well, if you want 7 bars, then you want your input to only have seven elements. Set:
y = [out1_c; out2_c; out3_c; out4_c; out5_c; out6_c; out7_c];
y now gives you the heights your bars will come up to on the y-axis. To locate the bars on the x-axis, define a vector x that also has seven elements, where each element gives the midpoint of where you want the bar to be on the x-axis. For example:
x = [100; 200; 300; 400; 500; 600; 700];
Then just use bar(x, y). This should get you started.
A final point on the code you posted, you can actually completely avoid the loops: read up on vectorization. But if you are going to insist on loops, the first and most important rule is to preallocate your vectors/matrices. In your code abc starts out as a scalar (a 1 by 1 matrix), but then for every p, you are adding an element at index p. What is actually happening in the background is for every p, matlab is scrapping the current abc you have in memory, and building it again from scratch with the additional element. As you might expect, this will slow down your code by many orders of magnitude.
You can set the width of the individual bars by passing a value between 0 and 1 to bar. Passing 1 indicates that there should be no space between the bars
bar(x,y,1)
Passing anything less than 1 will reduce the bar sizes and introduce spacing between the individual bars
bar(x,y,.5)