0
$\begingroup$

I have installed the "Drop to ground" addon. I have added the plane and renamed it to "Ground", took a normal cube and put on the plane some distance away from the plane. Then I selected the cube, Shift selected the plane and hit the button to the left - Drop to ground. It's giving an error and nothing is working.

Traceback (most recent call last):
file "C........ addons\object_drop_to_ground.py", line 166, in execute drop_objects (self, context)  
file "C........ addons\object_drop_to_ground.py", line 108, in drop_objects hit_location, hit_normal, hit_index = tmp_ground.ray_cast(lowest_world_co, lowest_world_co+down)  
valueError : too many values to unpack (expected3)  
location : <unknown location>:-1

I have downloaded the addon from this new link https://gist.github.com/mhulse/571947fbe5ca16b7f2b7

Can anybody give me solution for that error

$\endgroup$
  • $\begingroup$ Similarly to closest_point_on_mesh in blender.stackexchange.com/a/63361/15543 (see comment) ray_cast has an extra return value as of 2.76ish that returns the success of the ray cast blender.org/api/blender_python_api_2_78a_release/… Note: this is also outlined in the gist link comments in your Q. $\endgroup$ – batFINGER Nov 8 '16 at 13:45
  • $\begingroup$ may i know the solution plz sorry i dont know the language section. may i know what i have to do. can u plz download the addon and tell me whats the solution behind it im using 2.77a $\endgroup$ – atek Nov 8 '16 at 14:03
1
$\begingroup$

Object.ray_cast changed in 2.77 to include a "hit" return value giving the success of the hit.

You need to replace lines 108 to 111 with

        hit, hit_location, hit_normal, hit_index = tmp_ground.ray_cast(lowest_world_co, lowest_world_co + down)
        if not hit:
            print(ob.name, 'didn\'t hit the ground')
            continue

Full edit here https://gist.github.com/batFINGER/820d385839a222e5a10c1b7f5cdbd0b7

| improve this answer | |
$\endgroup$
  • $\begingroup$ i have download the zip file. In the zip file it contains folder and in that there is a file drop to ground but it does not have the extension. So i cant install it then i copied the text from the website and save with .py extension it installed successfully but when i click to activate now its give the error Traceback (most recent call last): file "C........ 2.77\scripts\modules\addon_utils.py, line 330, in enable mod=_imprt_(module_name) file "C........ 2.77\scripts\addons\drop ground.py", line 220 register() ^ IndentationError: expected an indented block $\endgroup$ – atek Nov 8 '16 at 15:33
  • $\begingroup$ Fixed the filename, the indent is ok you may have copied a bit more than the code. Try hitting the RAW button and using select all / copy on that page, or rename the file in the zip, or download zip again. $\endgroup$ – batFINGER Nov 8 '16 at 15:46
  • $\begingroup$ can u fix the problem for the new version for 2.78 and 2.78a also i have installed but after few 2min it kick me out to the desktop $\endgroup$ – atek Nov 8 '16 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.